#1733 Why not allow || to be same as |->|?

saltnlight5 Wed 14 Dec 2011

Hi,

So we have these literal syntaxes for Func

|Str s->Void|        // function which takes one Str arg and returns void
|Str s|              // same as above, omitting optional void return
|->Void|             // function which takes no arguments and returns void

Following these patterns, I would expect this:

||                   // shortcut for |->Void|

But intead we must define it as

|->|                 // shortcut for |->Void|

So is there a reason not use ||? It seems shorter and logical to me.

brian Wed 14 Dec 2011

Because || is the logical OR operator and it would be ambiguous.

saltnlight5 Wed 14 Dec 2011

Ah, forgot about OR operator. duh!

Too bad though... as that will be really short! :)

Login or Signup to reply.