The MSDN topic will be updated soon, it has a number of minor errors.

For now the spec

[link:research.microsoft.com]

is better. There are a limited number of ways to use ~ and ! which the spec talks about. The '$' mentioned in the docs is just wrong, you can't use it. The spec also gives a clear explanation of precedence.

By on 3/19/2010 11:43 AM ()

Thanks.

From new doc:

------------------------------------------------
Operators made of the following are always prefix operators
Ø repeated !
Ø repeated ~
Other operators beginning with these characters are not permitted.
------------------------------------------------

So does that mean that "!@", which I've switched to and does work, is not supposed to work?

thanks

By on 3/19/2010 3:23 PM ()

So does that mean that "!@", which I've switched to and does work, is not supposed to work?

Oh, oops, we have not yet released the RC version of the spec, which updates this. Yes, !@ is allowed as a prefix operator, and the updated spec will spell this out more clearly. Hopefully the spec update will arrive in the next couple weeks.

By on 3/22/2010 9:30 AM ()

It's not a critical issue, but I also think having Prolog-like flexibility when defining custom operators would be nice in F#.

To me, one of the main advantages in using F# is that it is a wonderful language in which to design application and domain specific languages. But sometimes the syntax does get a little rough. Having more flexible operator definition would subsume a lot of cases into the core of F# that would now have to be handled by FSLex and FSYacc (wonderful tools in their own right).

But like I said, it's just a wish, not a deal-breaker.

-Neil

By on 3/20/2010 8:15 AM ()

Yes. custom operator is very confusion in F#.

It seems that there is no way to define the precedence and many things have special meaning. Like '$' which cannot be used with anything else but can be by its own(is this a bug?) as from the error message, it should not be used at all but stand alone is allowed ? Again, I was trying to borrow the '$' from Haskell to make the code look nicer(yet again at the expense of some performance).

1
let $ f x = f x
By on 3/19/2010 10:12 AM ()

Again, I was trying to borrow the '$' from Haskell to make the code look nicer(yet again at the expense of some performance).

1
let $ f x = f x

In F# this is called "<|".

By on 3/19/2010 11:44 AM ()

I remember I have issue with '<|' when used in a chain especially when '|>' is also involved. $ seems to have an even lower precedence.

By on 3/19/2010 12:05 PM ()

> Yes. custom operator is very confusion in F#.
>It seems that there is no way to define the precedence and many things have special meaning

Although a completely custom op-name system is a nice-to-have, I'm perfectly happy to live within the rules at the moment - I just can't tell what they are from reading the docs or playing with the system.

By on 3/19/2010 10:22 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper