Little challenge

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Little challenge

stepharo
We are trying to find examples of variableSubclass:...
and with source code we could not find them.

Even looking in all the code did not work.

finally Object allSubclasses select: #isVariable worked but it would be
good that search to the code would take into account classdefinitions.
Or may be it does.

Stef and Luc working on the Pharo Mooc

Reply | Threaded
Open this post in threaded view
|

Re: Little challenge

stepharo
We tried

(Object allSubclasses select: #isVariable)
            reject: [ :each | each instVarNames isEmpty ]

and we discovered that we have no class in the system with named instance variables and indexed ones.
May be we are wrong. We are interested if you find one.


Now we created one

Object variableSubclass: #PPpoint
    instanceVariableNames: 'x y'
    classVariableNames: ''
    package: 'Web'

and this is strange  because inspecting PPoint new: 3 looks wrong since the variable zone arrives before
the named one as displayed.



Reply | Threaded
Open this post in threaded view
|

Re: Little challenge

Eliot Miranda-2
BlockClosure and Context.  Back in the day OrderedCollection was one (when become was cheap there was no need for the array inst car).  You want to say

Smalltalk allClasses select: [:c| c isVariable and: [c instSize > 0]]

_,,,^..^,,,_ (phone)

> On Jan 9, 2016, at 1:24 PM, stepharo <[hidden email]> wrote:
>
> We tried
>
> (Object allSubclasses select: #isVariable)
>             reject: [ :each | each instVarNames isEmpty ]
>
> and we discovered that we have no class in the system with named instance variables and indexed ones.
> May be we are wrong. We are interested if you find one.
>
>
> Now we created one
>
> Object variableSubclass: #PPpoint
>     instanceVariableNames: 'x y'
>     classVariableNames: ''
>     package: 'Web'
>
> and this is strange  because inspecting PPoint new: 3 looks wrong since the variable zone arrives before
> the named one as displayed.
>
>
> <hhbahgba.>

Reply | Threaded
Open this post in threaded view
|

Re: Little challenge

stepharo


Le 10/1/16 01:56, Eliot Miranda a écrit :
> BlockClosure and Context.  Back in the day OrderedCollection was one (when become was cheap there was no need for the array inst car).
Yes I remember in VW.

> You want to say
>
> Smalltalk allClasses select: [:c| c isVariable and: [c instSize > 0]]
>
> _,,,^..^,,,_ (phone)
>
>> On Jan 9, 2016, at 1:24 PM, stepharo <[hidden email]> wrote:
>>
>> We tried
>>
>> (Object allSubclasses select: #isVariable)
>>              reject: [ :each | each instVarNames isEmpty ]
>>
>> and we discovered that we have no class in the system with named instance variables and indexed ones.
>> May be we are wrong. We are interested if you find one.
>>
>>
>> Now we created one
>>
>> Object variableSubclass: #PPpoint
>>      instanceVariableNames: 'x y'
>>      classVariableNames: ''
>>      package: 'Web'
>>
>> and this is strange  because inspecting PPoint new: 3 looks wrong since the variable zone arrives before
>> the named one as displayed.
>>
>>
>> <hhbahgba.>
>