IoLanguage / io

Io programming language. Inspired by Self, Smalltalk and LISP.
http://iolanguage.org
Other
2.67k stars 299 forks source link

Colon in Identifier #253

Open kgksoft opened 11 years ago

kgksoft commented 11 years ago

Hello

Colon in Identifier very annoying. i must write: a :=2 instead a:=2

We have a lot of assignments and i find only 1 file with colon in Identifier. addons\ObjcBridge\samples\objc2ioTest.io This really necessary?

Can you or i rewrite IoLexer.c for getting rid of the colon in identifiers?

stevedekorte commented 11 years ago

IIRC, this was done for the objective-c bridge. Objective-C has methods like [point setX:0 y:1]; which, using colons in identifiers, we could directly translate to: point setX:y:(0,1). An update would requiring updating the ObjcBridge code as well. Does it seem worth it?

kgksoft commented 11 years ago

Can you using other symbol?

point setXy or point setX.y. ?

stevedekorte commented 11 years ago

I think that's a good idea and it's what I did with the Lua/Objective-C bridge I wrote (many years ago) but lately I've been seeing Objective-C method names that contain an underscore, at least for the first character. Maybe it would be helpful to see what other bridges are doing these days? Treating colon as special does seem awkward and was probably a mistake in retrospect. Then again, optional use of spaces and the ambiguity in meaning they imply also seems like an unnecessary source of confusion and extra logic.

kgksoft commented 11 years ago

My dream, using Io as main language in ERP-system. That would be cool :) Language-syntax must be simple and understandable. I always mistaken by a colon. I think others too.

stevedekorte commented 11 years ago

What do you think of the idea of making syntax entirely unambiguous in the sense that a given AST tree can only be expressed as source code in exactly one way?

kgksoft commented 11 years ago

https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/ObjCFromJavaScript.html Any colon (“:”) in the Objective-C selector is replaced by an underscore (“_”). Any underscore in the Objective-C selector is prefixed with a dollar sign (“$”). Any dollar sign in the Objective-C selector is prefixed with another dollar sign.

kgksoft commented 11 years ago

AST tree. I only one time read DragonBook :) I think lexical analyzer in iovm not so bad to be rewritten.

stevedekorte commented 11 years ago

Following the apple convention sounds reasonable though $ would then be an operator that requires special treatment.

stevedekorte commented 8 years ago

At this point I'd probably favor removing the colon in identifier rule as well. Objective-C integration isn't that important any more.

kgksoft commented 8 years ago

cool. i think IO best language what i know. :)

stevedekorte commented 8 years ago

Thanks :)