List Info

Thread: Re: criticism of the new syntax




Re: criticism of the new syntax
country flaguser name
United States
2007-12-19 18:40:58
 -------------- Original message ----------------------
From: Paolo Bonzini <paolo.bonzinilu.unisi.ch>
> Derek Zhou wrote:
> > On Tuesday 18 December 2007 12:06:59 am Stephen
Compall wrote:
> >> MyClass extend [
> >>     "more methods!"
> >> ]
> >>
> >> This is already in there.
> > Cool, how about one small step further, like:
> > MyClass category: 'new category' extend [
> >     "more methods!"
> > ]
> 
> Yes, even without the "extend" keyword,
that's feasible.

So, if I want to break down a large class into multiple
files with each file containing one category, what should I
write?
Object subclass: MyClass [
    | var1 var2|
]

MyClass class >> category: 'instance creation' [
    new [...]
]

MyClass category: 'category1' [
    method1 []
]

MyClass category: 'category2' [
    method2 []
]

What does the keyword "extend" do?

Derek


_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk

Re: criticism of the new syntax
country flaguser name
Switzerland
2007-12-20 03:11:26
>>> MyClass category: 'new category' extend [
>>>     "more methods!"
>>> ]
>> Yes, even without the "extend" keyword,
that's feasible.
> 
> So, if I want to break down a large class into multiple
files with each file containing one category, what should I
write?

So far, you need to use

MyClass extend [
]

and write the category manually in each method.  Regarding

MyClass category: '...' [
]

I said "it's feasible", and I'll implement it. 
But not now, it's too 
late in the release cycle.  I'm very sorry for this, it is a
valuable 
addition.

> What does the keyword "extend" do?

It basically says that instance variables declared with
"|a b c|" should 
be *added* to the existing one, instead of replacing them.

Paolo


_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk

Re: Re: criticism of the new syntax
user name
2007-12-20 22:20:32
On 20.12.2007 15:11:26, Paolo Bonzini wrote:
> >>> MyClass category: 'new category' extend [
> >>>     "more methods!"
> >>> ]
> >> Yes, even without the "extend"
keyword, that's feasible.
> >
> > So, if I want to break down a large class into
multiple files with  
> each file containing one category, what should I
write?
> 
> So far, you need to use
> 
> MyClass extend [
> ]
> 
> and write the category manually in each method. 
Regarding
> 
> MyClass category: '...' [
> ]
> 
> I said "it's feasible", and I'll implement
it.  But not now, it's too  
> late in the release cycle.  I'm very sorry for this, it
is a valuable  
> addition.

	Hi!
It's better to be named methodsCategory: or
methodsWithCategory:

BR. Ildar
-- 
Ildar  Mulyukov,  free SW designer/programmer
================================================
email: ildarusers.sourceforge.net
home: http://tuganger.narod.ru/
ALT Linux Sisyphus
================================================


_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk

Re: criticism of the new syntax
country flaguser name
United States
2007-12-21 20:14:57
On Fri, 2007-12-21 at 10:20 +0600, Ildar Mulyukov wrote:
> It's better to be named methodsCategory: or
methodsWithCategory:

Even better would be to look at the code for
STInST.GSTParser and work
out a way that the kinds of top-level blocks can be
extended, perhaps
based on message name, as they all parse as RBVariableNodes
or
RBMessageNodes.

That way you could experiment with different kinds of
top-level blocks
without altering the core or even GNU Smalltalk at all.

I have thought about how best to provide this modularly but
haven't come
up with anything good.

-- 
Our last-ditch plan is to change the forums into a podcast,
then send
RSS feeds into the blogosphere so our users can further
debate the
legality of mashups amongst this month's 20 'sexiest'
gadgets.
        --Richard "Lowtax" Kyanka

_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )