Am 01.05.2014 um 10:58 schrieb Dr. H. Nikolaus Schaller: > > Am 01.05.2014 um 10:31 schrieb Wolfgang Lux: > >> >> Am 01.05.2014 um 09:22 schrieb Dr. H. Nikolaus Schaller: >> >>> Hi, >>> >>> Am 01.05.2014 um 02:21 schrieb Kevin Ingwersen: >>> >>>> Hey! >>>> >>>> To explain this subject just a little. I come from actual web development >>>> - my roots are deeply in PHP. The only reason I ever learned C++, followed >>>> by C, was due to the need to write a php extension. But due to my C++ >>>> lectures, I came across objective-c, and fell in love with its syntax, >>>> basicaly x). But this made me ask the following question: >>>> >>>> Why is this not available in scripting? >>>> >>>> A year later, I had to ask: >>>> >>>> Is it even possible to use a scripting language, based on ObjC syntax, >>>> outside of OS X? >>>> >>>> To be honest, why is there none? Objective-C is a great language - not >>>> just for GUI coding. I find that its named parameters are a key-concept. >>>> It simply makes function calls so much more understandable - even when you >>>> return to your project a year later. My favorite example that I show >>>> friends is an actual person. See: >>>> >>>> Mother* mom = [[Mother alloc] init]; >>>> [mom pleaseBring:@"beer" to:@"Sofa" withAmount:1]; >>>> >>>> I do not need to explain this, do I :) >>>> >>>> But, I have not given up. Years after my discovery, I have had times where >>>> I took google searches…and at a random sudden, Objective-J was created! >>>> This is one amazing concept, as I see it. But the downside: You can’t >>>> embed it. >>>> >>>> So I wanted to ask this Objective-C community here: Is there a viable, >>>> cross-platform, scripting language with actual ObjC syntax? If not - why! >>>> :) >>> >>> I am not aware of any Obj-C interpreter. >>> >>> But there is Fscript: http://www.fscript.org/ >>> >>> which is some scripting language to inspect and manipulate Obj-C objects. >>> >>> But it uses a different syntax and appears to be the opposite of what you >>> are looking for. >> >> Fscript is a dialect of Smalltalk, so the syntax is much like that of >> Objective-C, except you don't need the square brackets. :-) > > This makes me wonder if the parser could be extended to *optionally* accept > square brackets to make learning (and copy&paste of algorithms) easier.
Unfortunately not, since Smalltalk uses square brackets for its own purposes, namely to enclose blocks. So both Mother alloc init pleaseBring:@"beer" to:@"Sofa" withAmount:1 and [Mother alloc init pleaseBring:@"beer" to:@"Sofa" withAmount:1] are valid Smalltalk expressions, but with completely different meanings. The former will create and initialize a Mother object and then send the message -pleaseBring:to:withAmount: to that object (with whatever result; I'd assume an exception "Go for yourself!"), while the latter creates a block object that creates the Mother object once you send a -value message to it. And of course there are some more differences in Smalltalk's syntax compared to Objective-C that I've glossed over, e.g., strings being enclosed with single quotes rather than double quotes. Wolfgang _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
