Begginer questions

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

Begginer questions

Jonathan Kelly
Hi,

firstly, is there somewhere that explains what the icons in the system
browser signify? (eg the three coloured dots)?

More importantly (to me anyway) ... I'm confused - why at: is defined in
Object and not SequenceableCollection?

Jonathan.

Reply | Threaded
Open this post in threaded view
|

Re: Begginer questions

Stéphane Ducasse

On Aug 4, 2011, at 9:10 AM, Jonathan Kelly wrote:

> Hi,
>
> firstly, is there somewhere that explains what the icons in the system
> browser signify? (eg the three coloured dots)?

... are for collections

>
> More importantly (to me anyway) ... I'm confused - why at: is defined in
> Object and not SequenceableCollection?

at: in Object is because some Object like array have variable size
        #(1 2 3)
        #()
        Array new: 6

have all different sizes

How this is encoded? when you create a class you use variableSubclass: instead of subclass:

Now how to access such elements?
using at:
and this is not only for Array.

BTW Collection subclass: #SequenceableCollection
so Sequenceable is not a variable class just an abstract class.

Now
Object>>at: index
        "Primitive. Assumes receiver is indexable. Answer the value of an
        indexable element in the receiver. Fail if the argument index is not an
        Integer or is out of bounds. Essential. See Object documentation
        whatIsAPrimitive. Read the class comment for a discussion about that the fact
        that the index can be a float."


>
> Jonathan.
>


Reply | Threaded
Open this post in threaded view
|

Re: Begginer questions

Mariano Martinez Peck


On Thu, Aug 4, 2011 at 9:22 AM, Stéphane Ducasse <[hidden email]> wrote:

On Aug 4, 2011, at 9:10 AM, Jonathan Kelly wrote:

> Hi,
>
> firstly, is there somewhere that explains what the icons in the system
> browser signify? (eg the three coloured dots)?

... are for collections

>
> More importantly (to me anyway) ... I'm confused - why at: is defined in
> Object and not SequenceableCollection?

at: in Object is because some Object like array have variable size
       #(1 2 3)
       #()
       Array new: 6

have all different sizes

How this is encoded? when you create a class you use variableSubclass: instead of subclass:

Now how to access such elements?
using at:
and this is not only for Array.

BTW Collection subclass: #SequenceableCollection
so Sequenceable is not a variable class just an abstract class.

Now
Object>>at: index
       "Primitive. Assumes receiver is indexable. Answer the value of an
       indexable element in the receiver. Fail if the argument index is not an
       Integer or is out of bounds. Essential. See Object documentation
       whatIsAPrimitive. Read the class comment for a discussion about that the fact
       that the index can be a float."



That's a great explanation. You can read more about that in a post I did a couple of months ago:
http://marianopeck.wordpress.com/2011/05/07/class-formats-and-compiledmethod-uniqueness/

Those I call "variable" are those where you can use #at:  #at:put: for example, etc... 


--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Begginer questions

Jonathan Kelly
Hi,

On Thu, 04 Aug 2011 09:54 +0200, "Mariano Martinez Peck"
<[hidden email]> wrote:

> On Thu, Aug 4, 2011 at 9:22 AM, Stéphane Ducasse
> <[hidden email]>wrote:
>
> >
> > On Aug 4, 2011, at 9:10 AM, Jonathan Kelly wrote:
> >
> > > Hi,
> > >
> > > firstly, is there somewhere that explains what the icons in the system
> > > browser signify? (eg the three coloured dots)?
> >
> > ... are for collections

I was asking is there somewhere that says what all of them are?

> >
> > >
> > > More importantly (to me anyway) ... I'm confused - why at: is defined in
> > > Object and not SequenceableCollection?
> >
> > at: in Object is because some Object like array have variable size
> >        #(1 2 3)
> >        #()
> >        Array new: 6
> >
> > have all different sizes
> >

It still seems to me then that you should have that defined in
Sequenceable and if someone what to do one of these variable things,
they variableSubclass off Sequenceable, or add in a VariableObject class
instead of overloading the beleagured Object. It's probably just my OCD
acting up - I like things being just right. lol

I'm struggling with the "How does it work? - I don't care" principle,
but persevering.

> > How this is encoded? when you create a class you use variableSubclass:
> > instead of subclass:
> >
> > Now how to access such elements?
> > using at:
> > and this is not only for Array.
> >
> > BTW Collection subclass: #SequenceableCollection
> > so Sequenceable is not a variable class just an abstract class.
> >
> > Now
> > Object>>at: index
> >        "Primitive. Assumes receiver is indexable. Answer the value of an
> >        indexable element in the receiver. Fail if the argument index is not
> > an
> >        Integer or is out of bounds. Essential. See Object documentation
> >        whatIsAPrimitive. Read the class comment for a discussion about that
> > the fact
> >        that the index can be a float."
> >
> >
>
> That's a great explanation. You can read more about that in a post I did
> a
> couple of months ago:
> http://marianopeck.wordpress.com/2011/05/07/class-formats-and-compiledmethod-uniqueness/
>
> Those I call "variable" are those where you can use #at:  #at:put: for
> example, etc...
>

Ouch, my brain hurts. Reading that made me think, has anyone suggested
that a way hiding the magic might be useful for those who just want to
learn Smalltalk to write applications? :)

Jonathan

>
> --
> Mariano
> http://marianopeck.wordpress.com
>