Well, set idea was just a small proposal, which had to help me in solving a
harder problem. I wanted to add something like extensionable literal. The
idea is that when compiler sees some special literal, it reads it, turns
into an object and sends #parse message to it. After that literal answers
so
Denis Kudriashov wrote
> We have similar mechanizm in Pharo. Look at
> http://dionisiydk.blogspot.fr/2016/07/magic-with-pharo-reflectivity.html
Wow! That's really cool. I like that we can do it without adding *any*
syntax. Tiny syntax is one of the more special things about the Smalltalk
language.
Debiller 777 wrote
> You know, literals are quite useful in case when you want to shorten some
> object initialization. For example #() and {} for arrays and $[]for byte
> arrays. However, if there is a way to add custom literals, for example for
> sets (something like #{} I guess)? how to do it? a
Hi.
сб, 28 апр. 2018 г., 1:26 Richard Sargent <
richard.sarg...@gemtalksystems.com>:
> On Fri, Apr 27, 2018 at 3:58 PM, Esteban A. Maringolo <
> emaring...@gmail.com> wrote:
>
>> oh, you were talking about how te VM views the object,
>> I was thinking in terms of how the compiler sees the text.
>>
Can you please tell more about ##() thing?
A
On 28 April 2018 at 20:21, Peter Uhnák wrote:
> What would entail actually extending the syntax and adding the set literal?
>
> From my brief observations (when I was discussing this with OP on discord):
>
> * adding a new AST node
> * extend RBParser
> * extend IRMethod/IRTranslator... maybe
What would entail actually extending the syntax and adding the set literal?
>From my brief observations (when I was discussing this with OP on discord):
* adding a new AST node
* extend RBParser
* extend IRMethod/IRTranslator... maybe generating bytecode for `{ ... }
asSet` instead would be enoug
The ## syntax that some Smalltalks have (Smalltalk/X, for
example, which calls it a Dolphin extension) is related
to Common Lisp's
#.e the result of evaluating e at *read* time,
taken as a literal
#,e the result of evaluating e at *load* time,
taken as a lite
Hi,
I think the question is
How automaticly create literal's objects , not initialize.
e.g
'aString'
#aSymbol
{ anArray}
#[]
Cheers Liang
On 28 April 2018 at 03:34, Clément Bera wrote:
> The guy who asked the question said: "...when you want to shorten some
> object initialization"
>
> Using ClassVariable is an alternative way to shorten object
> initialization, reading a ClassVariable is almost the same performance as
> reading a
On Fri, Apr 27, 2018 at 3:58 PM, Esteban A. Maringolo
wrote:
> oh, you were talking about how te VM views the object,
> I was thinking in terms of how the compiler sees the text.
>
> So I'm talking about literals "syntax".
>
> Thanks anyway for the "trick" :)
>
Another common technique is a "onc
oh, you were talking about how te VM views the object,
I was thinking in terms of how the compiler sees the text.
So I'm talking about literals "syntax".
Thanks anyway for the "trick" :)
On 27/04/2018 16:34, Clément Bera wrote:
> The guy who asked the question said: "...when you want to shorten
The guy who asked the question said: "...when you want to shorten some
object initialization"
Using ClassVariable is an alternative way to shorten object initialization,
reading a ClassVariable is almost the same performance as reading a
literal, so that looked like a good alternative to me. Both
On 27/04/2018 15:35, Richard Sargent wrote:
> On Fri, Apr 27, 2018 at 2:08 PM, Esteban A. Maringolo
> mailto:emaring...@gmail.com>> wrote:
> As far as I knew the only way to have new literals was to modify the
> compiler.
>
>
> Yes.
>
> VA Smalltalk has an interesting syntax extension w
On Fri, Apr 27, 2018 at 2:08 PM, Esteban A. Maringolo
wrote:
> Hi Clément,
>
> On 27/04/2018 10:32, Clément Bera wrote:
> > Obviously sets are not as easy to deal with. You cannot mutate empty
> > arrays/bytearrays, if you concatenate something it creates a new object.
> > You can add things in s
Hi Clément,
On 27/04/2018 10:32, Clément Bera wrote:
> Obviously sets are not as easy to deal with. You cannot mutate empty
> arrays/bytearrays, if you concatenate something it creates a new object.
> You can add things in sets. So you need to be careful... You can make
> the object read-only to a
Not really.
You can use ClassVariables though. Here's an example for Sets:
Object subclass: #MyClass
instanceVariableNames: ''
classVariableNames: 'MyClassVar'
package: 'MyPackage'
MyClass class>>initialize
super initialize.
MyClassVar := Set new.
MyClass>>foo
self bar: MyClassVar
17 matches
Mail list logo