[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax |
Date: |
Wed, 14 Mar 2007 08:46:03 +0100 |
User-agent: |
Thunderbird 1.5.0.10 (Macintosh/20070221) |
>> One would need something like
>>
>> Object subclass: #MyClass!
>> MyClass comment: 'A simple example class'!
>>
> Given the alternative I'd keep the exclamation point. I can't imagine
> what would an interactive session look like. I'm over my head here,
> though. Come to think of it, Eval [] heavily reminds me of an ordinary
> function call.
The exclamation point is going to remain exactly for interactive
sessions. Remember that -- anyway -- what's badly needed is, as Mike
pointed out earlier in this thread, nothing more than an easily parsable
syntax that denotes the *structure* of the program rather than how to
reconstruct it.
That's the main reason why I am suspicious of syntaxes that are
pure Smalltalk. It looks to me, though I might be wrong, that
having "Object subclass: #MyClass!" is as bad as having
"Object methodsFor: 'abc'!". If somebody just adds a new method
like
refine
"Define a subclass of self, with the same name, in the current
namespace."
self environment = Namespace current ifTrue: [ self halt ].
self subclass: self name!
how can you expect things to be parsed correctly when one writes:
Set refine!
Set comment: 'not your ordinary set'!
> But I'd
> rather choose that than using the temporary variable declaration
> literal. I've gotten used to the idea that they're "temporary" and
> conceptually only exist during execution of something. A lifetime of an
> object seems far too different to be called "execution" of the object.
Not if you consider a method's lifetime to be a context, and temporaries
to be instance variables of the context (they are in fact)...
And replying to Mike:
> I thought you might say that, but there's really no reason why you
> should insist on defining class instance variables in the class method
> scope.
I fail to parse this, sorry. In fact, the bang syntax for class
instance variables is
Foo class
instanceVariableNames: 'uniqueInstance'!
which is "defined on the class" just like class methods.
In fact, the 1:1 mapping is *not* between instance and class variables,
but within instance and class-instance variables.
> The redundancy in the scope declaration and its message-send form.
>
> Well, I can see that I'm going to have to agree to disagree.
Not at all. For example, what if
Class [
...
]
were a shortcut for
Class ref: WhateverClassIsInScope class [
...
]
Then class methods and class instance variables would be just like
Class [
| uniqueInstance |
uniqueInstance [ ^uniqueInstance ]
uniqueInstance: anObject [ uniqueInstance := anObject ]
new [
self uniqueInstance ifFalse: [ self uniqueInstance: super new ]
^self uniqueInstance
]
]
Is the above proposal any better?
Paolo
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, (continued)
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, parasti, 2007/03/11
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Paolo Bonzini, 2007/03/12
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, parasti, 2007/03/12
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Paolo Bonzini, 2007/03/13
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Stewart Stremler, 2007/03/13
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Paolo Bonzini, 2007/03/13
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Stewart Stremler, 2007/03/14
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Mike Anderson, 2007/03/13
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, parasti, 2007/03/13
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Stephen Compall, 2007/03/13
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax,
Paolo Bonzini <=
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, parasti, 2007/03/14
- [Help-smalltalk] Re: [RFC] Smalltalk scripting syntax, Paolo Bonzini, 2007/03/15
- [Help-smalltalk] Re: [RFC] Smalltalk scripting syntax, parasti, 2007/03/16
- [Help-smalltalk] Directions for GNU Smalltalk (was Re: [RFC] Smalltalk scripting syntax), Paolo Bonzini, 2007/03/16
- [Help-smalltalk] Re: Directions for GNU Smalltalk (was Re: [RFC] Smalltalk scripting syntax), parasti, 2007/03/17
- Re: [Help-smalltalk] Re: Directions for GNU Smalltalk (was Re: [RFC] Smalltalk scripting syntax), Paolo Bonzini, 2007/03/18
- Re: [Help-smalltalk] Re: Directions for GNU Smalltalk (was Re: [RFC] Smalltalk scripting syntax), parasti, 2007/03/18
- Re: [Help-smalltalk] Re: Directions for GNU Smalltalk (was Re: [RFC] Smalltalk scripting syntax), Paolo Bonzini, 2007/03/19
- Re: [Help-smalltalk] Re: Directions for GNU Smalltalk (was Re: [RFC] Smalltalk scripting syntax), parasti, 2007/03/19
- Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax, Mike Anderson, 2007/03/14