#1410 non-ascii characters in function names

chubeza Sun 13 Feb 2011

have you considered letting function names have characters

like ?, - and ! ? they may signify a boolean returning function like those IsX and also signify a destructive function.

I always felt it limiting when using languages like java or c#.

tcolar Sun 13 Feb 2011

That would make parsing difficult, if even possible.

? would particularly be troublesome as it can be used in functions to mark nullity.

chubeza Sun 13 Feb 2011

well, many modern languages do that, factor, ruby ... if I'm not mistaken, null? is on the type, so the function name can still be distinguished.

I haven't yet used fantom, even haven't installed it yet, but it looks promising, alot of little good choices.

I feel it's better to have unicode qualified language, and not limit the users without reason. maybe someone with more experience about parsing can give a note on its feasability. my guess is that it's possible, but may lead to different conventions among users.

tcolar Sun 13 Feb 2011

I mean for example:

// create a function called isItNull?
isItNull? := |Obj? obj -> Void| { return obj==null }

the call it.

// This might work, but look so much like a null check call it's very confusing 
itsItNull?.call(null)

and I'm not sure if a function can be nullable or not, but if it is, then it would be even weirder looking

Func? isItNull?
isItNull = |Obj? obj -> Void| { return obj==null }
itsItNull??.call(null)

brian Mon 14 Feb 2011

Certainly we considered alternate chars in identifiers and/or method names, but it was rejected :-)

While it is cool to allow it, there are two problems with that design:

  1. it limits the characters you can use for operators and what you can do with the grammar (we wanted to keep as much of C/C#/Java syntax as we could). It really works best with a language like Lisp which have a very simple grammar
  2. I personally think it often leads to unreadable code

Akcelisto Mon 14 Feb 2011

Scala have this feature. I write on Scala and I tired from this feature.

Login or Signup to reply.