Re: [Newbies] How to empty a collection?

2008-02-19 Thread Bert Freudenberg

On Feb 19, 2008, at 10:53 , Marcin Tustin wrote:

Re-initialize how? I can't see a way to run object initialisation  
over again on an existing object.



Everything in Smalltalk happens by sending a message. How was your  
object initialized? By sending a message. How can you initialize it  
again? Send the message again.


Case in point - OrderedCollection. How is it initialized? Look at  
#new:. It sends #setCollection:. So send #setCollection: with a new  
Array and you're done.


Well, of course you're not *supposed* to be doing this. But you  
could, and it would only be half-evil ;)


- Bert -


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Loading Rome SVG package

2008-02-19 Thread Bert Freudenberg

On Feb 19, 2008, at 0:47 , Marcin Tustin wrote:


I can load the following packages out of the squeaksource repository:
Rome-Balloon
Rome-Base
Rome-PluginCanvas
Rome-SVG
Rome-Strike
Rome-Tests
Rome-Reference
Rome-BalloonCanvas

The rest give me errors about lacking other classes, which I  
reproduce below. Are the packages that load enough to be useful, or  
am I going to be stuffed when playing around with Rome?


You only need Rome-Base, Rome-Balloon, Rome-PluginCanvas to get  
started, provided you have the Rome plugin. To experiment without the  
plugin, load Rome-Reference and Rome-BalloonCanvas, too.


This is actually noted on http://squeaksource.com/Rome.html

The reason is that Rome supports several back-ends, the PluginCanvas  
uses Cairo, BalloonCanvas uses Balloon2D.


If so, where should I get the dependencies? Also, there's a lack of  
class comments. Is there documentation elsewhere? Is Rome even  
ready to be used at all?


Rome is used in the Sophie project.

Rome-Demo also gives me a syntax error: fontFor: aCanvas family:  
aFamily style: aStyle has a full stop after the comment. After  
fixing this it gives me an error because RomeFreetypeCanvas is not  
recognised.


Rome-Freetype seems to only live at

http://source.impara.de/Rome.html

(the repository used by the Sophie developers)


Thanks all!

Rome-Tweak depends on:
This package depends on the following classes:
  CMatrixTransform
  CBitmapFill
  CTransformCanvas
  CDisplayTransform
  CCostumeFill
  CGraphicsFill
  CNoFill
  CIdentityTransform
  CProjectBuilder
  CSolidFill
  CGradientFill
  COffsetTransform


These are Tweak classes. Ignore if you do not use Tweak.


Rome-FontManager:
This package depends on the following classes:
  FreetypeFontFace
  FreetypeFont


The FontManager is Sophie-specific. It depends on Freetype:

http://source.impara.de/freetype.html


Rome-Plugin:
This package depends on the following classes:
  SmartSyntaxInterpreterPlugin
  CCodeGenerator
  TSendNode



This is the plugin source code, you need it only if you want to  
translate and compile your own plugin.


- Bert -


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: [Seaside] Re: More Election nominations please!

2008-02-19 Thread Randal L. Schwartz
 tim == tim Rowledge [EMAIL PROTECTED] writes:

tim I'll second that. We need to see more *serious* interest in running  this
tim community or it will fade into moribundity.

I'd be happy to throw my hat into the ring, but I'm afraid of being laughed at
for not having much more to contribute than 25 years of smalltalk experience
and having followed squeak as an interested user since its first announcement.
I also have a lot of experience promoting and supporting Perl, and I imagine
that this might be useful to a Squeak board.

So, would people consider my contributions useful?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread Brian Murphy-Dye
My understanding as well is that this is the purpose of #become:, but
also that it is not very efficient in some versions of Smalltalk. If
you are using an OrderedCollection, this is probably a reasonably
efficient method as it doesn't need to search through the whole list
every time it removes an element:

removeAll
[self notEmpty] whileTrue: [self removeLast]

Brian.


On Feb 18, 2008 6:42 PM, Marcin Tustin [EMAIL PROTECTED] wrote:
 My own testing suggests that references to the object remain in place. I
 would guess that that is the whole point of become.



 On Feb 19, 2008 1:38 AM, cdrick [EMAIL PROTECTED] wrote:

 
   Isn't Cedrick's aida solution going to be significantly faster?
  
 
  this is not mine :)
 
  butI'd interested to see if it's a good use of #become:... Does it
  keep references ? is it safe ?
 
  Thanks
 
 
 
  ___
  Beginners mailing list
  Beginners@lists.squeakfoundation.org
  http://lists.squeakfoundation.org/mailman/listinfo/beginners
 


 ___
 Beginners mailing list
 Beginners@lists.squeakfoundation.org
 http://lists.squeakfoundation.org/mailman/listinfo/beginners


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: [Seaside] Re: More Election nominations please!

2008-02-19 Thread Randal L. Schwartz
 Ron == Ron Teitelbaum [EMAIL PROTECTED] writes:

Ron I've read a number of your posts and consider you to be a very active
Ron member of our community.  I would think that you would be considered a
Ron very serious candidate for the board.  Are you declaring your candidacy?

Then, yes.  I would be happy to bring my contributions and abilities to the
Squeak board to help preserve, develop, and promote Squeak.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: [Seaside] Re: More Election nominations please!

2008-02-19 Thread Igor Stasenko
On 19/02/2008, Matthew Fulmer [EMAIL PROTECTED] wrote:
 On Mon, Feb 18, 2008 at 03:51:39PM -0800, tim Rowledge wrote:
  I'll second that. We need to see more *serious* interest in running this
  community or it will fade into moribundity.

 I love this community. I'll run for board. The biggest thing I
 want to make happen is serious compatibility between croquet and
 the squeak release. I also want a lot more communication between
 the board and the wider community. I can do that.

 So, I'll volunteer as a board candidate


I've been asked by Ron to step up as a potential member of newly
formed Technical board.
My primary concern is to improve VM, make it shiny and polished, and
don't canonize it too much.
To be appeal for developers, squeak should show a constant progress in
this area as well.
We are at the rise of multi-core era, and squeak should respond on
that with own, ultimate ways :)
So, if you so dare to see some innovation in VM vote for me :)

-- 
Best regards,
Igor Stasenko AKA sig.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread Randal L. Schwartz
 Brian == Brian Murphy-Dye [EMAIL PROTECTED] writes:

Brian My understanding as well is that this is the purpose of #become:, but
Brian also that it is not very efficient in some versions of Smalltalk. If
Brian you are using an OrderedCollection, this is probably a reasonably
Brian efficient method as it doesn't need to search through the whole list
Brian every time it removes an element:

Brian removeAll
Brian [self notEmpty] whileTrue: [self removeLast]

What makes you think #removeLast doesn't need to search through the whole list
in some kinds of OrderedCollection?  You *do* have an implementation
assumption there.

I'd just do:

removeAll
self notEmpty ifTrue: [self become: self species new].

and let subclasses make it more efficient using implementation knowledge.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread Reinout Heeck

[EMAIL PROTECTED] wrote:

The *normal* way people usually do it thoiugh is to *not depend on the
identity* of the Collection - different objects should typically not
share the same Collection. And if you don't share - then the easy way
out is to just do:

myCollection := OrderedCollection new or whatever class you use

...in order to empty it.



A word of caution: identity should be preserved in the 'normal' case, 
replacing with another collection should be regarded as the exceptional 
case. Your assertion that different objects should typically not share 
the same Collection. is only valid in limited cases.


I'm talking from my experience with building mvc-based apps on 
VisualWorks. Code needs to be decoupled, ie 'model' objects and 
collections should not know about the UI's that are coupled to them, 
this is achieved with the various dependency mechanisms available in VW.


Changing identity of the collections will break this paradigm big time 
(regardless of whether the dependents are managed in a global dictionary 
or by the collection itself).






As to the implementation of #removeAll on non-growable collections: 
follow whatever pattern the squeak library uses for other messages that 
alter the size (#add:, #remove:,...). In VW the idiom is to call 
#shouldNotImplement.




Cheers,

R
-
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread Bert Freudenberg

On Feb 19, 2008, at 16:06 , cdrick wrote:
So, following Bert suggestion, would it be possible to change  
removeAll: from...



I'm pretty certain I did not suggest anything like this. Nothing is  
broken here, so let's not fix it.


A new feature would be adding #removeAll, which sounds reasonable¹.

- Bert -

¹I do smell a bit of premature optimization here, or does anyone have  
a really convincing use case?


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 17:21:57 +0100, Klaus D. Witzel wrote:


On Tue, 19 Feb 2008 16:56:48 +0100, cdrick wrote:



 Or maybe, if aCollection == self, a warning could be raised ?

 What do you think ?

Thumbs down, I do not want anybody copy a collection behind my back
(however small or large it is) just because remove* has nothing to do  
with copy.



Ok, I can understand.
What about the error ?


This is a bug, Smalltalk cannot compromise its fundamental structures  
(#removeAll is ANSI). Enter the report if not already on mantis  attach  
your fix.


Sorry, s/#removeAll /#removeAll: /


/Klaus




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 16:06:50 +0100, cdrick wrote:

...

I forgot that in my first attemp (and I knew that !)...

col := #(1 2 3) asOrderedCollection.
col  removeAll: col.
^col   returns an OrderedCollection(2)

col  removeAll: col copy is ok.

So, following Bert suggestion, would it be possible to change removeAll:  
from...


removeAll: aCollection
aCollection do: [:each | self remove: each].
^ aCollection
to

removeAll: aCollection
aCollection copy do: [:each | self remove: each].
^ aCollection
or

removeAll: aCollection
aCollection == self
ifTrue: [aCollection copy do: [:each | self remove: each]]
ifFalse: [aCollection do: [:each | self remove: each]].
^ aCollection

or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove: each]].

Or maybe, if aCollection == self, a warning could be raised ?

What do you think ?


Thumbs down, I do not want anybody copy a collection behind my back  
(however small or large it is) just because remove* has nothing to do with  
copy.



Cédrick



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 16:56:48 +0100, cdrick wrote:



 Or maybe, if aCollection == self, a warning could be raised ?

 What do you think ?

Thumbs down, I do not want anybody copy a collection behind my back
(however small or large it is) just because remove* has nothing to do  
with copy.



Ok, I can understand.
What about the error ?


This is a bug, Smalltalk cannot compromise its fundamental structures  
(#removeAll is ANSI). Enter the report if not already on mantis  attach  
your fix.


/Klaus


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread goran
Hi!

Reinout Heeck [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  The *normal* way people usually do it thoiugh is to *not depend on the
  identity* of the Collection - different objects should typically not
  share the same Collection. And if you don't share - then the easy way
  out is to just do:
  
  myCollection := OrderedCollection new or whatever class you use
  
  ...in order to empty it.
 
 
 A word of caution: identity should be preserved in the 'normal' case, 

I agree. While I still think relying too much on identities is a
dangerous practice.

 replacing with another collection should be regarded as the exceptional 
 case. Your assertion that different objects should typically not share 
 the same Collection. is only valid in limited cases.

Well, I still stand by it as a general nice rule. :)

 I'm talking from my experience with building mvc-based apps on 
 VisualWorks. Code needs to be decoupled, ie 'model' objects and 
 collections should not know about the UI's that are coupled to them, 
 this is achieved with the various dependency mechanisms available in VW.

I know, I used VW back in the 2.5-3.x days and while I first thought the
adapter-frenzy was cool I later also started thinking it was
over-engineered as hell. ;)
 
 Changing identity of the collections will break this paradigm big time 
 (regardless of whether the dependents are managed in a global dictionary 
 or by the collection itself).

Yes, if your adapters/UI components etc cling onto the collections
themselves, then yes, you will be bitten big time. I still think that
paradigm is fishy - but again, I only presented the way people
*typically* go about this thing - I still of course would like to
preserve identity and introduce #removeAll. It is better in all
respects.

If the *intent* is to remove all elements - then the message should
state exactly that intent. Doing stuff like aColl copy do: [:each |
aColl remove: each] is just plain dumb and silly, though it would
probably qualify as a default implementation in class Collection. :)

regards, Göran
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread goran
[EMAIL PROTECTED] (Randal L. Schwartz) wrote:
  Brian == Brian Murphy-Dye [EMAIL PROTECTED] writes:
 
 Brian My understanding as well is that this is the purpose of #become:, but
 Brian also that it is not very efficient in some versions of Smalltalk. If
 Brian you are using an OrderedCollection, this is probably a reasonably
 Brian efficient method as it doesn't need to search through the whole list
 Brian every time it removes an element:
 
 Brian removeAll
 Brian [self notEmpty] whileTrue: [self removeLast]
 
 What makes you think #removeLast doesn't need to search through the whole list
 in some kinds of OrderedCollection?  You *do* have an implementation
 assumption there.
 
 I'd just do:
 
 removeAll
 self notEmpty ifTrue: [self become: self species new].
 
 and let subclasses make it more efficient using implementation knowledge.

I would never use become: in regular code like this. :)

regards, Göran
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Looking back... (was Re: [Newbies] How to empty a collection?)

2008-02-19 Thread goran
Hi all!

Ok, since this was discussed AT PAINFULLY GREAT LENGTH back in aug/sept
2002 I just wanted to give you some reading on the subject at hand.
Don't *ever* presume the issue you are bringing attention to hasn't been
argued to death already :) :)

Threads of discussions related to this from 2002:

http://lists.squeakfoundation.org/pipermail/squeak-dev/2002-August/04315
7.html
http://lists.squeakfoundation.org/pipermail/squeak-dev/2002-September/04
3926.html
http://lists.squeakfoundation.org/pipermail/squeak-dev/2002-September/04
3928.html

Especially Richard O Keefe did an awesome job back then IIRC.

Now, if those threads will not exhaust you completely :) - then feel
free to hack up a changeset that is a conclusion of all findings in
there. :)

regards, Göran
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Re: How to empty a collection?

2008-02-19 Thread cdrick
  
   Or maybe, if aCollection == self, a warning could be raised ?
  
   What do you think ?
 
  Thumbs down, I do not want anybody copy a collection behind my back
  (however small or large it is) just because remove* has nothing to do
  with copy.
 
  Ok, I can understand.
  What about the error ?

 This is a bug, Smalltalk cannot compromise its fundamental structures
 (#removeAll is ANSI). Enter the report if not already on mantis  attach
 your fix.


I actually didn't meant it was a bug :) I need to be sharper with
my english... I meant raising an error message if self == aCollection
... Could it be a fix ?

Because in a way, the behavior is not really an error, it's more a bad
use because we know it's iterative and then, self and aCollection
change in the same time...

I hope you don't take my remarks, as I want to change smalltalk... I
just want to understand it better ;)

Cheers

Cédrick

ps: by the way, I'll open a bug report, as finally I think it's an
error (arf) because I shouldn't be aware removeAll is
iterativeetc... so here is the bug report
(http://bugs.squeak.org/view.php?id=6937).
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: Looking back... (was Re: [Newbies] How to empty a collection?)

2008-02-19 Thread johnps11
Hi Goran!

I just want to point out that the long links in your mail were broken for
me (although a little cut and paste fixed that). Perhaps a service like
tinyURL would be useful when sending long links from the dark and distant
past.

I have noticed in this thread an undertone of #become is the Devil's
playground

Could someone succinctly explain to someone who is a coarse and styless
programmer like myself why this is so, and when its use is justified?


Thanks,

John (keeping the newb in newbie for many years now)

 Hi all!

 Ok, since this was discussed AT PAINFULLY GREAT LENGTH back in aug/sept
 2002 I just wanted to give you some reading on the subject at hand.
 Don't *ever* presume the issue you are bringing attention to hasn't been
 argued to death already :) :)

 Threads of discussions related to this from 2002:

 http://lists.squeakfoundation.org/pipermail/squeak-dev/2002-August/04315
 7.html
 http://lists.squeakfoundation.org/pipermail/squeak-dev/2002-September/04
 3926.html
 http://lists.squeakfoundation.org/pipermail/squeak-dev/2002-September/04
 3928.html


snip

 regards, Göran


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to empty a collection?

2008-02-19 Thread nicolas cellier

cdrick a écrit :


or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove: each]].

Or maybe, if aCollection == self, a warning could be raised ?

What do you think ?

Cédrick



aCollection == self is not the only case that can fail.
Imagine i pass a wrapper collection on self, like a MappedCollection.

When i will change self with remove:, i will also change the argument 
which is just a wrapper on self.


Hope my explanations are not too much confusing...

Nicolas

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 21:01:14 +0100, nicolas cellier wrote:


cdrick a écrit :

 or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove: each]].
 Or maybe, if aCollection == self, a warning could be raised ?
 What do you think ?
 Cédrick



aCollection == self is not the only case that can fail.
Imagine i pass a wrapper collection on self, like a MappedCollection.

When i will change self with remove:, i will also change the argument  
which is just a wrapper on self.


Hope my explanations are not too much confusing...


Let's see: Remove each element of aCollection from the receiver. If  
successful for each, answer aCollection. Otherwise create an error  
notification.


What mapping would *not* raise the error notification ;-)

BTW: MappedCollection does not exist in sq3.10-7159dev08.02.1.image ...

/Klaus


Nicolas



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: Looking back... (was Re: [Newbies] How to empty a collection?)

2008-02-19 Thread Michael van der Gulik
On Feb 20, 2008 8:47 AM, [EMAIL PROTECTED] wrote:

 Hi Goran!

 I just want to point out that the long links in your mail were broken for
 me (although a little cut and paste fixed that). Perhaps a service like
 tinyURL would be useful when sending long links from the dark and distant
 past.

 I have noticed in this thread an undertone of #become is the Devil's
 playground

 Could someone succinctly explain to someone who is a coarse and styless
 programmer like myself why this is so, and when its use is justified?



Hi John the Newbie.

It would be appreciated if you replied under a quoted message rather than
above it.

I've just sent an email in the original thread about this.

It's use would only be justified if there are no other options. I've used it
myself in my remote object architecture[1] for converting a
message-capturing object proxy into the original object when an object is
migrated between computers. My intention was to keep the remoteness of the
objects involved as hidden as possible, making the use of #become:
necessary. In retrospect, it was a big and dangerous time-waster. Many
images died to bring me this information.

Originally, the Collections framework in Squeak used become: to grow some
collections. The blue book design of the Smalltalk VM[2] has an object
lookup table where the implementation of #become: was very fast - switch a
single pointer. The Squeak VM uses direct pointers between objects now, so
the entire object memory needs to be scanned.

[1] http://www.gulik.co.nz/dpon_design.pdf, http://www.squeaksource.com/DPON
.
[2] http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_imp_toc.html

Gulik.


-- 
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread Michael van der Gulik
On Feb 20, 2008 8:09 AM, Randal L. Schwartz [EMAIL PROTECTED] wrote:

  goran == goran  [EMAIL PROTECTED] writes:
  I'd just do:
 
  removeAll
  self notEmpty ifTrue: [self become: self species new].
 
  and let subclasses make it more efficient using implementation
 knowledge.

 goran I would never use become: in regular code like this. :)

 First, how regular is it if the method hasn't been missed by anyone
 in 27 years. :)

 Second, what are you objecting to?  #become: is clearly a part of the
 image,
 and works fine.  This code also cleans out a grown collection to be the
 smallest it possiby can become, where delete-one-at-a-time solutions
 don't.



#become: and its friends are voodoo. Don't use them in your code unless you
have absolutely no other option.

It doesn't work fine. It breaks code that relies on hashes; specifically, a
Dictionary elsewhere in your image can start acting screwy if you do a
#become: variant that doesn't preserve an object's hash. See
#becomeForwardcopyHash:. You would then also be relying on a Squeakish
behaviour and your code would become less portable across Smalltalk
dialects.

They are also a fantastic way to introduce bugs of various sorts, and can
even cause an image to crash (as in, stack trace and exit to the OS). Say,
for example, that one of the arguments you pass is accidently nil, true or
false? Your image would continue working... for a while.

#become: and variants are also very slow and causes the equivalent of a full
GC on every invocation.

Gulik.


-- 
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: [Squeak 0006937]: removeAll: aCollection doesn't do what we expect if aCollection==self

2008-02-19 Thread Klaus D. Witzel

Hi nicolas,

in your counter example you have forgotten that this bug is about  
failure of removal, but your example does not fail, instead it removes all  
elements (in Squeak 3.9, where MappedCollection still exists).


Can you tell us why? And please only add code to bug reports which does  
what you claim; things which don't work can be discussed here :)


/Klaus

On Tue, 19 Feb 2008 21:28:25 +0100 a NOTE has been added to this issue:

==
http://bugs.squeak.org/view.php?id=6937
==
Reported By:cdrick
Assigned To:
==
Project:Squeak
Issue ID:   6937
Category:   Collections
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
==
Date Submitted: 02-19-2008 18:12 UTC
Last Modified:  02-19-2008 20:28 UTC
==
Summary:removeAll: aCollection doesn't do what we  
expect if

aCollection==self
Description:
This known error has had a revival originating from a mail of Sophie in  
the

beginnner list... and I ended up opening a bug report...

The problem is:

col := #(1 2 3) asOrderedCollection.
col  removeAll: col.
^col   returns an OrderedCollection(2) instead of an empty one as we  
would

expect...
==

--
 kwl - 02-19-08 18:51
--
OrderedCollection-removeAll-kwl-6937.st tested with the 441 cases in the
CollectionTests category, all green.

--
 nicolas cellier - 02-19-08 20:28
--
As posted in beginners list, self == aCollection does not handle case  
when

aCollection is just a wrapper on self...
So the change won't removeAll problems...
in a 3.9 image try this:

| collec1 collec2 |
collec1 := OrderedCollection with: 'a' with: 'b' with: 'c'.
collec2 := MappedCollection collection: collec1 map: (3 to: 1 by: -1).
collec1 removeAll: collec2.
collec1 inspect

Agree, yet, the problem lies in super...
Note: MappedCollection was removed from 3.10, but in spirit there can be
other wrapper collections (i used some myself).

Issue History
Date Modified   Username   FieldChange
==
02-19-08 18:12  cdrick New Issue
02-19-08 18:51  kwlFile Added:
OrderedCollection-removeAll-kwl-6937.st
02-19-08 18:51  kwlNote Added: 0011843
02-19-08 20:28  nicolas cellierNote Added: 0011846
==



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to empty a collection?

2008-02-19 Thread nicolas cellier

Klaus D. Witzel a écrit :

On Tue, 19 Feb 2008 21:01:14 +0100, nicolas cellier wrote:


cdrick a écrit :

 or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove: each]].
 Or maybe, if aCollection == self, a warning could be raised ?
 What do you think ?
 Cédrick



aCollection == self is not the only case that can fail.
Imagine i pass a wrapper collection on self, like a MappedCollection.

When i will change self with remove:, i will also change the argument 
which is just a wrapper on self.


Hope my explanations are not too much confusing...


Let's see: Remove each element of aCollection from the receiver. If 
successful for each, answer aCollection. Otherwise create an error 
notification.


What mapping would *not* raise the error notification ;-)



My interpretation of the comment was rather for the case when we try to 
remove an element which is not in the collection...

But OK, I take it as is...

However i can construct a test case that will not do what is expected 
and will not raise a notification, wanna bet?


| collec1 collec2 |
collec1 := OrderedCollection with: 'a' with: 'b' with: 'c'.
collec2 := MappedCollection collection: collec1 map: (1 to: 2).
collec2 only map first two elements 'a' and 'b'
collec1 removeAll: collec2.
this should remove 'a' and 'b' from collec1
self assert: collec1 first = 'c'
too bad... it's 'b'


BTW: MappedCollection does not exist in sq3.10-7159dev08.02.1.image ...



MappedCollection is just an example of possible wrapper collection, even 
if there is none in core images nowadays, that's a classical pattern 
which avoid copying for example.


MappedCOllection is in 3.9 image.


/Klaus


Nicolas


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Recap: How to empty a collection

2008-02-19 Thread Blake
I've been following this debate with some interest, but I think it's gone  
beyond a noob discussion.


Is there a noob answer to this question? There ought to be. I'm sort of  
leaning toward:


Q. How do you empty a collection.
A. You don't, you replace it with a new instance.

Q. What if you have references to the collection in multiple places?
A. Wrap the collection in another class, and reference that.

??
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 22:14:49 +0100, Blake wrote:

I've been following this debate with some interest, but I think it's  
gone beyond a noob discussion.


Is there a noob answer to this question? There ought to be. I'm sort of  
leaning toward:


Q. How do you empty a collection.
A. You don't, you replace it with a new instance.

Q. What if you have references to the collection in multiple places?
A. Wrap the collection in another class, and reference that.

??


 Q. can I use #become: instead of wrapper?
 A. yes but the pro's don't like solutions with #become:, it smells

/Klaus



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 22:00:09 +0100, nicolas cellier wrote:


Klaus D. Witzel a écrit :

On Tue, 19 Feb 2008 21:01:14 +0100, nicolas cellier wrote:


cdrick a écrit :

 or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove:  
each]].

 Or maybe, if aCollection == self, a warning could be raised ?
 What do you think ?
 Cédrick



aCollection == self is not the only case that can fail.
Imagine i pass a wrapper collection on self, like a MappedCollection.

When i will change self with remove:, i will also change the argument  
which is just a wrapper on self.


Hope my explanations are not too much confusing...
 Let's see: Remove each element of aCollection from the receiver. If  
successful for each, answer aCollection. Otherwise create an error  
notification.

 What mapping would *not* raise the error notification ;-)



My interpretation of the comment was rather for the case when we try to  
remove an element which is not in the collection...

But OK, I take it as is...

However i can construct a test case that will not do what is expected  
and will not raise a notification, wanna bet?


No, just let the next people who attempt to bring MappedCollection back to  
Squeak  3.10 take care ;-)


BTW: do you have as much energy for fixing problems as you seem to have  
for imagine the currently non-existing ;-) This would help Squeak jump  
forward :)



| collec1 collec2 |
collec1 := OrderedCollection with: 'a' with: 'b' with: 'c'.
collec2 := MappedCollection collection: collec1 map: (1 to: 2).
collec2 only map first two elements 'a' and 'b'
collec1 removeAll: collec2.
this should remove 'a' and 'b' from collec1
self assert: collec1 first = 'c'
too bad... it's 'b'


BTW: MappedCollection does not exist in sq3.10-7159dev08.02.1.image ...



MappedCollection is just an example of possible wrapper collection, even  
if there is none in core images nowadays, that's a classical pattern  
which avoid copying for example.


MappedCOllection is in 3.9 image.


/Klaus


Nicolas



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Mathieu Suen

On Feb 19, 2008, at 10:36 PM, Klaus D. Witzel wrote:


On Tue, 19 Feb 2008 22:14:49 +0100, Blake wrote:

I've been following this debate with some interest, but I think  
it's gone beyond a noob discussion.


Is there a noob answer to this question? There ought to be. I'm  
sort of leaning toward:


Q. How do you empty a collection.
A. You don't, you replace it with a new instance.

Q. What if you have references to the collection in multiple places?
A. Wrap the collection in another class, and reference that.

??


Q. can I use #become: instead of wrapper?
A. yes but the pro's don't like solutions with #become:, it smells


and it's slow in Squeak.




/Klaus



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Mth




___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: How to empty a collection?

2008-02-19 Thread nicolas cellier

Klaus D. Witzel a écrit :

On Tue, 19 Feb 2008 22:00:09 +0100, nicolas cellier wrote:


However i can construct a test case that will not do what is expected 
and will not raise a notification, wanna bet?


No, just let the next people who attempt to bring MappedCollection back 
to Squeak  3.10 take care ;-)




As a user of collection wrappers, proposed patch just hit the alarm 
buzzer my nervous brain is equipped with.


But your position is wise. As long as a MappedCollection, lazy list or 
lazy collection (see these projects on SqueakSource) are all created 
under our control, we can manage...


BTW: do you have as much energy for fixing problems as you seem to have 
for imagine the currently non-existing ;-) This would help Squeak jump 
forward :)




That's precisely how i find and fix unknown bugs:
Imagine how i could break current implementation.

For this reason, most patches i proposed are minor.
Hope a few are usefull, since adopted in 3.8.1, 3.9 and 3.10.
Any minor contribution counts anyway :)

Nicolas

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Blake
On Tue, 19 Feb 2008 14:20:51 -0800, Mathieu Suen [EMAIL PROTECTED]  
wrote:



On Feb 19, 2008, at 10:36 PM, Klaus D. Witzel wrote:


On Tue, 19 Feb 2008 22:14:49 +0100, Blake wrote:

I've been following this debate with some interest, but I think it's  
gone beyond a noob discussion.


Is there a noob answer to this question? There ought to be. I'm sort  
of leaning toward:


Q. How do you empty a collection.
A. You don't, you replace it with a new instance.

Q. What if you have references to the collection in multiple places?
A. Wrap the collection in another class, and reference that.

??


Q. can I use #become: instead of wrapper?
A. yes but the pro's don't like solutions with #become:, it smells


and it's slow in Squeak.


Well, from what I was reading, slow and smells is putting it too  
mildly. It sounds like it can corrupt your image, i.e., leave you with  
non-working objects in unexpected places. I wouldn't even mention it.

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread nicolas cellier

Blake a écrit :

Well, from what I was reading, slow and smells is putting it too 
mildly. It sounds like it can corrupt your image, i.e., leave you with 
non-working objects in unexpected places. I wouldn't even mention it.


Huh?
Have a proof of what you wrote?

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Blake
On Tue, 19 Feb 2008 15:08:56 -0800, nicolas cellier [EMAIL PROTECTED]  
wrote:



Blake a écrit :

Well, from what I was reading, slow and smells is putting it too  
mildly. It sounds like it can corrupt your image, i.e., leave you with  
non-working objects in unexpected places. I wouldn't even mention it.


Huh?
Have a proof of what you wrote?


Proof? None at all. I just have this, by Gulik:

[become:] doesn't work fine. It breaks code that relies on hashes;  
specifically, a Dictionary elsewhere in yo ur image can start acting  
screwy if you do a #become: variant that doesn't preserve an object's  
hash. See #becomeForwardcopyHash:. You would then also be relying on a  
Squeakish behaviour and your code would become less portable across Sm  
alltalk dialects.


They are also a fantastic way to introduce bugs of various sorts, and can  
even cause an image to crash (as in, stack trace and exit to the OS). Say,  
for example, that one of the arguments you pass is accidently nil, true or  
false? Your image would c ontinue working... for a while.


Does this sound like something a newbie should use? No, it does not.

===Blake===
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] How to empty a collection?

2008-02-19 Thread goran
[EMAIL PROTECTED] (Randal L. Schwartz) wrote:
  goran == goran  [EMAIL PROTECTED] writes:
  I'd just do:
  
  removeAll
  self notEmpty ifTrue: [self become: self species new].
  
  and let subclasses make it more efficient using implementation knowledge.
 
 goran I would never use become: in regular code like this. :)
 
 First, how regular is it if the method hasn't been missed by anyone
 in 27 years. :)
 
 Second, what are you objecting to?  #become: is clearly a part of the image,
 and works fine.  This code also cleans out a grown collection to be the
 smallest it possiby can become, where delete-one-at-a-time solutions don't.
 
 And, if there's a more efficient thing for subclasses, they can certainly
 override it.

Yes, I probably agree it would be a nice default implementation. Modulo
someone now telling us we missed something of course. :)

regards, Göran
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Blake
On Tue, 19 Feb 2008 15:19:40 -0800, nicolas cellier [EMAIL PROTECTED]  
wrote:


But become: is still essential for operations like growing the  
MethodDictionary when you add new methods to a class, or migrate  
allInstances when you a or remove an instance variable to a class, to  
name few.

So, it is not bogus. Just handle with care.


OK. Does a newbie need to use it? To empty a collection? (Or whatever?)

I'm trying to get at what should be a very simple thing without going to  
the metal, as it were.


One thing I wasn't clear on is whether Bert's suggestion:

aColl removeAllSuchThat: [:anElement| true].

Is okay, and why it's okay while many of the other similar approaches were  
not.

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] [Election 2008] Nominations soon ended - presentations and QA coming up!

2008-02-19 Thread goran
Hi all!

Ok, we have 11 candidates so far! Perfect. Now the first phase -
Nominations - ends on the 22nd and then the campaigning period starts:

22nd to 25th:

Candidates present themselves and their candidacy, preferrably by
posting an article on SqP: 

http://people.squeakfoundation.org

During this period I also urge you to look at the 10 questions we have
cooked up for the candidates at:

http://wiki.squeak.org/squeak/6029

...and if you feel some important question is missing - email me in
private and I will (if I think it is a good thing) put it in the last 5
open slots. First 5 served, then it is full! Deadline for sending me
extra questions is the 24th.

25th to 29th:

Candidates will answer (or not!) the questions by posting to squeak-dev.
Feel free to discuss at length of course, the posts from the candidates
will be added by me to the Swiki page so that all answers can be seen in
one place.

As always, election details are at: http://wiki.squeak.org/squeak/6025

regards, Göran

PS. IMPORTANT: In order to vote - be sure to confirm that you have an
account on people.squeakfoundation.org and that your email address is up
to date. If you are not already registered on the site do so as soon as
possible. Include information about your participation in the Squeak
community to aid everyone in determining your appropriate certification.
If you have misplaced your people.squeakfoundation.org password there is
a link on the login page to allow you to reset it.  When the voting
period starts all voters will receive an email with instructions and a
link to the voting website.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread nicolas cellier

Blake a écrit :
On Tue, 19 Feb 2008 15:08:56 -0800, nicolas cellier 
[EMAIL PROTECTED] wrote:



Blake a écrit :

Well, from what I was reading, slow and smells is putting it too 
mildly. It sounds like it can corrupt your image, i.e., leave you 
with non-working objects in unexpected places. I wouldn't even 
mention it.


Huh?
Have a proof of what you wrote?


Proof? None at all. I just have this, by Gulik:

[become:] doesn't work fine. It breaks code that relies on hashes; 
specifically, a Dictionary elsewhere in yo ur image can start acting 
screwy if you do a #become: variant that doesn't preserve an object's 
hash. See #becomeForwardcopyHash:. You would then also be relying on a 
Squeakish behaviour and your code would become less portable across Sm 
alltalk dialects.




I see, become: does exchange #identityHash, and that makes our 
IdentityDictionary work, god thanks, but there is no such provision for 
ordinary #hash and Dictionary...


However, there are plenty of ordinary things that would have the same 
result:


| key1 key2 dic |
key1 := 'abc' copy.
key2 := 'abd' copy.
dic := Dictionary new.
dic at: key1 put: 1.
dic at: key2 put: 2.
key1 at: 1 put: $z.
{dic includesKey: key1.
dic keys includes: key1.}

So i propose newbies do not use #at:put: considering the danger about 
Dictionary not finding their keys...

That's too much.

becomeForward: is squeakish, but the thread was about Squeak 
implementation of a core library...

A rule is to use becomeForward: only with a just created object as argument.
But right, that's just too much for this thread.

They are also a fantastic way to introduce bugs of various sorts, and 
can even cause an image to crash (as in, stack trace and exit to the 
OS). Say, for example, that one of the arguments you pass is accidently 
nil, true or false? Your image would c ontinue working... for a while.


Does this sound like something a newbie should use? No, it does not.

===Blake===


OK, good lesson, thank you.
Handle with care.
Try finding better patterns.
Protect usage (don't use with an unknow argument).
It smells.
I agree.
But don't pretend it's broken please.

Anyway, why do you think all code is accessible in Smalltalk?
In the spirit, nothing is to be hidden from newbies eyes.
Yes I know, maybe some code should

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Blake
On Tue, 19 Feb 2008 15:59:57 -0800, nicolas cellier [EMAIL PROTECTED]  
wrote:


However, there are plenty of ordinary things that would have the same  
result:


| key1 key2 dic |
key1 := 'abc' copy.
key2 := 'abd' copy.
dic := Dictionary new.
dic at: key1 put: 1.
dic at: key2 put: 2.
key1 at: 1 put: $z.
{dic includesKey: key1.
dic keys includes: key1.}

So i propose newbies do not use #at:put: considering the danger about  
Dictionary not finding their keys...


This seems pretty bad to me, too, but it seems more designed to break a  
known weakness than to actually accomplish something. You know, like empty  
a collection.s


But I'd probably argue that the above should work, and that it's a design  
flaw that it doesn't.



Anyway, why do you think all code is accessible in Smalltalk?
In the spirit, nothing is to be hidden from newbies eyes.
Yes I know, maybe some code should


There's a positive fetish about this. I'm all for everything being  
accessible. But everything being equally accessible all the time is not  
pragmatic.

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


RE: [Newbies] How to empty a collection?

2008-02-19 Thread Ramon Leon
  Well, of course you're not *supposed* to be doing this. But 
 you could, 
  and it would only be half-evil ;)
 It wouldn't be evil at all.  This is Smalltalk, not Ada!!
 
 But seriously, it seems a major oversight that such a basic 
 task isn't in the standard protocol.  The language has been 
 around a while, someone else must have wanted to empty a collection.
 
 --
 Jeffrey Straszheim
 http://straszheim.50megs.com

It not being standardized just means there's no consensus to the *right* way
to do it.  I'd bet many of us have our own versions of #removeAll in our
images, I know I do.

Ramon Leon
http://onsmalltalk.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread nicolas cellier

Blake a écrit :
On Tue, 19 Feb 2008 15:59:57 -0800, nicolas cellier 
[EMAIL PROTECTED] wrote:


However, there are plenty of ordinary things that would have the same 
result:


| key1 key2 dic |
key1 := 'abc' copy.
key2 := 'abd' copy.
dic := Dictionary new.
dic at: key1 put: 1.
dic at: key2 put: 2.
key1 at: 1 put: $z.
{dic includesKey: key1.
dic keys includes: key1.}

So i propose newbies do not use #at:put: considering the danger about 
Dictionary not finding their keys...


This seems pretty bad to me, too, but it seems more designed to break a 
known weakness than to actually accomplish something. You know, like 
empty a collection.s




Yes, the example is dumb, but that's the kind of thing that happens in 
real code (just split contructing/changing keys/accessing in three 
different methods).
No use to forbid become: for this reason, there are better reasons (it's 
slw), become: usage was sponsored once upon a time when it was fast, 
providing both efficient and generic solutions.


But I'd probably argue that the above should work, and that it's a 
design flaw that it doesn't.




Yes, but it is very hard to make it work efficiently.
So that's a limitation we must be aware of.


Anyway, why do you think all code is accessible in Smalltalk?
In the spirit, nothing is to be hidden from newbies eyes.
Yes I know, maybe some code should


There's a positive fetish about this. I'm all for everything being 
accessible. But everything being equally accessible all the time is not 
pragmatic.


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Michael van der Gulik
On Feb 20, 2008 2:17 PM, nicolas cellier [EMAIL PROTECTED] wrote:

 Blake a écrit :
  On Tue, 19 Feb 2008 15:59:57 -0800, nicolas cellier
  [EMAIL PROTECTED] wrote:
 snip



Could we please move this discussion to squeak-dev please? We're going to
scare the beginners.

Gulik.

-- 
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] More Morphic Fun

2008-02-19 Thread Jeffrey Straszheim
I want to create a container -- a panel -- that will contain other 
Morphs, but within which I can drag the morphs around.  If the more were 
dragged out from the container it should be deleted.


What is the most straightforward way to do this?  Drag and drop?

--
Jeffrey Straszheim
http://straszheim.50megs.com

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Klaus D. Witzel

On Wed, 20 Feb 2008 02:01:49 +0100, nicolas cellier wrote:

...

Bert's suggestion is simple and works well.
The only question is about efficiency.
Up to (Down to?) subclasses to optimize it.

Some proposed an alternative based on (self removeAll: self), and  
started writing optimized versions of #removeAll:.


No, (anOrderedCollection removeAll: anOrderedCollection) was not  
optimized. It had a *very* long known bug, which was fixed. Please do less  
mixing of subjects in threads.


I think our biggest problem is that we have plenty possible ways to do  
it... Finding a balance between genericity and efficiency...


No, more correctness at the price of less efficiency :)


Nicolas



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] More Morphic Fun

2008-02-19 Thread karl

Jeffrey Straszheim wrote:
I want to create a container -- a panel -- that will contain other 
Morphs, but within which I can drag the morphs around.  If the more 
were dragged out from the container it should be deleted.


What is the most straightforward way to do this?  Drag and drop?

Use a PasteUpMorph which is the one used as the desktop. Use mouseLeave 
to do the delete.


Karl
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners