Re: [Newbies] Scope?
Casey == Casey Ransberger casey.obrie...@gmail.com writes: Casey Yes, class variables will be visible to subclasses of subclasses Casey and so on. Also, I didn't mention pool variables, but 99.9% of Casey the time you won't want to use those. +1 -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix consulting, Technical writing, Comedy, etc. etc. Still trying to think of something clever for the fourth line of this .sig ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Float-Subclasses?
bb == bb bblo...@arcor.de writes: bb onionmixer.net/extra_data/gst.pdf You keep bring up GNU Smalltalk. Not to be annoying, but you *do* realize this is a *Squeak* Smalltalk newbie list. If you want to get started with Squeak, check out the Squeak tutorials at http://squeak.org/Documentation/ If you want to learn GNU Smalltalk instead, I'm sure there's an appropriate mailing list for you to join. Please don't ask about GNU Smalltalk here. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.posterous.com/ for Smalltalk discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: ifTrue ifFalse help
Tobias == Tobias Pape das.li...@gmx.de writes: Tobias Every character is just a string of the length 1 (just like you Tobias used it in the first place). Not really. That would imply $a is 'a'. And it's very much not, which is what the OP is discovering. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.posterous.com/ for Smalltalk discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Exception question
Erlis == Erlis Vidal er...@erlisvidal.com writes: Erlis I'm having problem with the line in red. I don't see anything in red. Please note that many of us read messages in plain ASCII or unicode, not crappy HTML-pretending-to-be-email. Erlis The method is pretty simple, it Erlis just create a new MessageNotUnderstood instance and then send the message: Erlis and receiver: messages, but it also *signal *the exception, which I was Erlis thinking will finish the method execution, but if that's the case, Why the Erlis red line? Why returning anything after signaling the exception? I think you're referring to the fact that someone can say resume even after the signal has been thrown. That will return back to *this* context, and resend the original message. That's exactly the flow you want if you want a chance to fix something in a debugger, and then retry the original request. The debugger proceed will come back to here, but the original message needs to be resent, probably poking at a new version of a method (or one of the methods it calls). -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.posterous.com/ for Smalltalk discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] error handling
Erlis == Erlis Vidal er...@erlisvidal.com writes: Erlis After finishing Squeak By Example I have an unanswered question Erlis and is about the error handling. I could see in the book how to Erlis raise an error with the message error: but what I couldn't find Erlis anywhere is how to react when an error occurs. The Exception framework is quite nice. Google for squeak exception tutorial and I'm sure you'll find some more details. I believe there is also some in-image documentation for the Exception class and its subclasses. Here's one http://www.chrisburkert.de/index.php?node_id=73 -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.posterous.com/ for Smalltalk discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] error handling
Ken == Ken G Brown kbr...@mac.com writes: Ken And a draft chapter on Exceptions from Pharo by Example 2 at: Ken http://pharobyexample.org/ Yes, quite nice. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.posterous.com/ for Smalltalk discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Can't enter class comment?
Tim == Tim Johnson tjohn...@iwu.edu writes: Tim Fresh 4.2 image. Opened Browser. Made a new category. Made a new Tim class. Tried to change the class comment but can't. Can't, can't, Tim can't. Can you? For me, it always goes back to THIS CLASS HAS NO Tim COMMENT! What is going on? Do you get an error when you command (or option or control or alt) s to save? I took 4.2 trunk, and it worked for me. And for me, it doesn't say this class has no comment. It says: A Randal is . Instance Variables Are you sure you're using the system browser? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.posterous.com/ for Smalltalk discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [OT] Re: [Newbies] Smalltalk klass dokumentation ?
Kommentaren == Kommentaren kommenta...@bredband.net writes: Kommentaren Documentation is important. Agreed. Which is why it's so easy to create class comments, and method comments, and browse/search those comments *while* you are using the code. We don't need dead trees or static docs. We want docs that are as alive as the code is. Kommentaren Sun knows what they are doing. Hardly. Sun doesn't even exist anymore. How knowing is that? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [OT] Re: [Newbies] Smalltalk klass dokumentation ?
Hannes == Hannes Hirzel hannes.hir...@gmail.com writes: Hannes Coming up with class comments for Squeak is a hard job because it Hannes involves a lot of design recovery. And that's completely unrelated to the problem at hand. The original question seems to be why isn't there javadoc for Smalltalk? My reply is Javadoc sucks compared to Smalltalk's embedded tools. Don't confuse that with the issue that the current *image* is probably underdocumented. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [OT] Re: [Newbies] Smalltalk klass dokumentation ?
David == David T Lewis le...@mail.msen.com writes: David Actually, the original question was this: David I wonder if there is any documentation that documents the David different classes and methods available in Smalltalk. Preferably David like javadoc in java. Right, and the answer to this is Yes, *inside the image*, which makes it nicely searchable and maintainable, although the current image lacks adequate documentation. And thank goodness this is nothing like Javadoc. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Adding method to Smallinteger class
Herbert == Herbert König herbertkoe...@gmx.net writes: Herbert larger: anInteger Herbert return the larger of self and anInteger Herbert 6 larger: 10 Herbert Herbert anInteger self ifTrue: [^anInteger] ifFalse: [^self] or even larger: anInteger ^self max: anInteger Code re-use, bay-bee. And to see what defines max:, open a method finder, type max: in the proper window, and you can see the three classes that define max:. The one closest to yours is Magnitude, which is anything that has a linear comparability. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Array questions
noobie == noobie pntball...@aol.com writes: noobie I have a few questions about writing methods dealing with noobie arrays Arrays are a kind of Collection. Smalltalk's collection classes have a very rich protocol. If you start with Collection in a Hierarchical Browser, you'll see a dozen classes that derive from Collection and are optimized for different things. The key methods are #select:, #detect:, #reject:, #collect:, and #inject:into:. Learn those first, because your methods would be built trivially with them, and then could be placed at Collection, not at Array, since your problem is more general than Arrays. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] JSON parsing..
sergio == sergio 101 sergiol...@village-buzz.com writes: sergio pulled in my data... saved it to a string.. sergio then did: sergio json stream: jData. I think you want a Stream there, not a String. easy enough: json stream: jData readStream. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Howto initialize class variables
Alex == Alex Schenkman a...@schenkman.info writes: Alex Bert your are super! Alex * never call super initialize on the class side Alex Why? I thought it was polite to do it, =) It breaks things by double initializing them. The code loaders run initialize automatically. So when the parent class was loaded, it was already initialize. You've just asked it to do that again. On the *instance* side, you *must* call super initialize, because you don't get another chance to do that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] sorting elements in OrderedCollection
sergio == sergio 101 sergiol...@village-buzz.com writes: sergio if i have people, which is a list of person(s), how would i spit out a sergio list sorted by last name? collection asSortedCollection: [:a :b | a lastName = b lastName ] -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Can a block be a string?
Andy == Andy Burnett andy.burn...@knowinnovation.com writes: Andy I just wanted to make sure I hadn't completely misunderstood blocks! No, not completely. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Can a block be a string?
Andy == Andy Burnett andy.burn...@knowinnovation.com writes: Andy When I looked at the definition for paragraph: it says that takes a aBlock, Andy but then doesn't seem to do a value: aBlock. So, what I am wondering is Andy whether it is valid to give a string as a block, or whether this is just a Andy slightly loose definition of block? As I recall, the seaside things that have contents accept renderables, which is anything that understands #renderOn:. Seaside monkey-patches Object to ensure that *everything* has a #renderOn:, but there are special overrides for Collection, String, and, as you've discovered, BlockContext. Browse all implementors of #renderOn: for more illumination. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Get rid of an object
lanas == lanas la...@securenet.net writes: lanas Now, if I 'do it' once more on the first line the inspect window will lanas still show the same variables being set. It's inspecting the old object, yes. lanas If I open another inspect window on myCar I get the new object, lanas without any variables yet set. It's another object, distinct from the previous one. lanas So it looks like objects of the same name are considered separate lanas entities. No, the first one no longer has a name. The inspector has a reference to it, though. lanas I'd have thought that perhaps doing a 'do it' on myCar a lanas second time would have re-initialized the first existing object. No. You created a new car, then gave it the name myCar in the current workspace, completely releasing any previous object that myCar might have referenced. The thing to get is that when you say: x := y then any thing that was previously in x cannot be affected. The assignment is always performing a new binding to a new object. lanas If I create 25 myCar for various tests, then there'll be 25 myCar lanas objects laying around in the image ? How to get rid of them ? Garbage is collected constantly by a background process. You can force it, but there's generally no need. Your car bits will eventually be recycled bits. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] System Browser: instance vs. class
lanas == lanas la...@securenet.net writes: lanas I would like to know what is the practical difference between lanas instance and class in the System Browser. Based on the Abstract lanas Factory example from Alpert's 'Desgin Patterns' book: A class is always a singleton. There is only one class named Car in the system. However, there can be many car instances, usually created by sending new to Car. In the Car class, you'd hold information collectively about all cars, such as the default specifications or number of cars produced. In each car instance, you'd hold information about a specific car, like its color or owner. Does that help? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Using same class names
lanas == lanas la...@securenet.net writes: lanas In other words, is there a way to quickly switch from one experiment lanas to the other when each of these experiments would use the same class lanas names and probably many of the same method names ? I think you'd need to use subclasses, and therefore your tests should use parameterized class names. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] A question about returning values from a block
An explicit answer from a block exits the method in which the block is defined. This is often used for easy answers in a method: someMethodFor: aValue aValue 3 ifTrue: [^7]. aValue 10 ifTrue: [^aValue * 10]. ^aValue complexExpressionHere. As you discovered, if you don't answer from a block, the block's value is the last expression evaluated. You actually *can* return a value from the middle of a block, but at that point, the code within the block is better factored out as a separate method. In fact, nested blocks and complex blocks and desire to have complex control inside a block are all signs that you aren't yet thinking in terms of small, single-purpose methods. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Check wheater an instance of a class is actually there or not
Hans == Hans Gruber ru...@web.de writes: Hans Now to my question: Hans How may I check wheater an instance of a class (in my case MyFileLibrary) has been created and exists at the time I check it. Hans (MyFileLibrary = nil) is always false. Hans I need this, because wenn an Instance of MyFileLibrary exists at the Hans checking time, I want to proceed with an other method than I want to Hans proceed with when an instance of MyFileLibrary does not exists. Sounds like you want the singleton pattern. The easiest way to do that is to not create instances at all, and just dump all of your methods class side, and all of your instance variables as class instance variables. Then treat MyFileLibrary as if it is the only instance that ever exists, and has a global name. If that's not what you want, explain more. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] can't find sources
LordGeoffrey == LordGeoffrey lordgeoff...@optusnet.com.au writes: LordGeoffrey I tried gunzipping the sources but apparently its not a zip file. LordGeoffrey I am unix (Ubuntu). Any suggestions? It's a gzip file, not a zip file, and yes, you need to uncompress it. Ideally, your .image and .changes file are named the same, and in same directory (folder), and your VM and .sources file are in the same directory as each other, which may or may not be the same as the .image and .changes file. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] OrderedCollection if imageMorphs
Christine == Christine Wolfe cwd...@earthlink.net writes: Christine For sure I'm going to start now - I don't see where it could ever hurt Christine anything if I initialize twice. It can, so I wouldn't conclude so quickly, or cargo-cult this one without some more research. Behavior#new calls #initialize, so someone broke the chain between there and your classes of interest by overriding #new without respecting the existing protocol. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] OrderedCollection if imageMorphs
Christine == Christine Wolfe cwd...@earthlink.net writes: Christine I created a class, SymbolArray, that is a subclass of Christine OrderedCollection with the following initialize method. Each of the Christine items I'm adding (SymbolBlank, SymbolGet, etc) is an imageMorph. Ahh, there's the mistake... missed it before. You really really really do *not* want to create a subclass of OrderedCollection. Your object will *have* an OrderedCollection, but should not *be* one. If you want to respond to all of the protocol of OrderedCollection, feel free to delegate it to your actual instance variable. Yes, it's a bright shiny object to want to subclass that, but just like subclassing SmallInteger, it's both legal and dumb. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] OrderedCollection if imageMorphs
Christine == Christine Wolfe cwd...@earthlink.net writes: Christine Oh, I'm so so sorry - I thought it was OK to ask dumb questions on Christine the newbie forum (blush) I'll try to figure out how to make an Christine instance variable an order collection. It's perfectly OK, and that's why you were corrected. :) Basically, you'll do the following: * add an instance variable: contents on your instance side, add: initialize super initialize. contents := OrderedCollection new. then for each item of the collection protocol, delegate it, as in: add: anItem ^contents add: anItem. includes: anItem ^contents includes: anItem. size ^contents size. and so on. If you get really tired of adding all of them, just add them as you need them (when the debugger tells you :). If you wanna get really tricky, you can add a #doesNotUnderstand: handler to perform the method on the contents variable, but that can mess up your debugging, so it's better if you don't. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Closure support
Andy == Andy Burnett andy.burn...@knowinnovation.com writes: Andy Randal said... Andy With classic smalltalk 80 and Squeak: Andy a := (1 to: 10) do: [:n | [n]]. Andy b := a collect: [:each | each value]. Andy b will have something like #(10 10 10 10 ...). Argh. That should have been collect: not do: Andy Out of curiosity I tried changing it to [:n | [n*10]], expecting the numbers Andy to be ten times bigger, but they were stil 1, 2, 3... I also tried removing Andy the whole block, and b still evaluated to the same values. Works better with collect. :) a := (1 to: 10) collect: [:n | [n * 10]]. b := a collect: [:each | each value] b is now #(10 20 30 40 50 60 70 80 90 100) in a closure world. In non-closure, it would have been 100, 100, 100... -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to introspect method instance variables
rdmerrio == rdmerrio rdmer...@gmail.com writes: rdmerrio The question around the instance variables stems from the fact that rdmerrio they appear to be tantalizingly close to the surface given the fact rdmerrio that the Browser recognizes undeclared identifiers and asks if they rdmerrio are temps or instance and then plugs in the code for me. Not the browser, the compiler. And the compiler knows all the identifiers in scope, or it couldn't compile the code. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Help me FileIn
K == K K Subramaniam subb...@gmail.com writes: K Squeak fileOuts are binary files, not text; though they contain lot of K ASCII characters. Really? When did they change? In classic Squeak, fileouts were basically the classic ST80 format, which is clearly human-readable text. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Help me FileIn
K == K K Subramaniam subb...@gmail.com writes: K But not native text files (they are not opened in ascii mode). Code fileOuts are K a database of data chunks. See Bert's explanation at: K http://lists.squeakfoundation.org/pipermail/squeak-dev/2007-May/116683.html That explanation is about .sources and .changes, not fileOuts. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Help me FileIn
K == K K Subramaniam subb...@gmail.com writes: K On Monday 17 Aug 2009 12:17:25 am Randal L. Schwartz wrote: That explanation is about .sources and .changes, not fileOuts. K The class fileout (from browser into *.st files) uses the same format K (sequence of data chunks) as *.sources and *.changes files. Did you have K some other fileOuts in mind? Are you sure? It looks like the fileout I *just* got is classic ST-80 format, with ! delimiting Smalltalk code. There's no binary data in here... it's all human-readable text (chunks of smalltalk code). That's different from the .sources and .changes, because they have some binary data in them (I thought). -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Help me FileIn
Overcomer == Overcomer Man overcomer@gmail.com writes: Overcomer Somehow the design of Squeak omits fileIn from the same menu as Overcomer fileOut so it's hard to know what works on fileOut is going to Overcomer work on fileIn. I'm trying to convert software written in another Overcomer Smalltalk and it would help to file it in. At least adopting each Overcomer class to Squeak's fileIn format would be easier than copying in Overcomer every method one at a time. So please help me fileIn. Thanks. The starting point for a fileOut is a class or package. Hence, fileOut appears there. The starting point for a fileIn is a filename, from a file/directory browser. Hence, fileIn appears there. Does that help? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Where to ask questions - Squeak Beginners and Squeak Dev?
Frank == Frank Church vfcli...@googlemail.com writes: Frank What sort of questions are appropriate to each group (really means Frank which questions should you not ask on Squeak Developers)? Squeak-dev is the original mailing list for Squeak. Squeak-beginners was set up so as not to scare off people when the core team talks about closure compilers and browser plugin environments on squeak-dev. Feel free to post beginner questions on either list. Just don't be scared if you don't understand everything (yet) that goes by on squeak-dev. If you're posting about a non-squeak Smalltalk on either list, it would be best to disclose that up front, because the presumption is that you're using Squeak. And while no promise of help is *ever* given (this isn't a help desk!), you might even further adjust your expectations about getting help with non-squeak smalltalks on a Squeak mailing list. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] DB support newb questions
Gian == Gian Holland gia...@gmail.com writes: Gian Is it very easy to query proprietary DB systems such as Sql server or Gian Oracle with squeak? SqueakDBX can do some of that. http://wiki.squeak.org/squeak/6108 -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] [Q] Best way of doing ...
Edgar == Edgar J De Cleene edgardec2...@yahoo.com.ar writes: Edgar People: Edgar I need a way for two collections of different size could be tested for all Edgar elements in both. Edgar Example: Edgar A := #(a1 a2 a3). Edgar B := #(b1 b2 b3 b4 b5). Edgar Some similar to Edgar with: otherCollection do: twoArgBlock Edgar Evaluate twoArgBlock with corresponding elements from this collection Edgar and otherCollection. Edgar otherCollection size = self size Edgar But for different size When they are different sizes, what do you want done with mismatched elements? Call the block anyway, passing nil for the shorter list? Or not call the block at all? And depending on your choice, you should name the method clearly: withOverlappingElementsOf:do: with:ifAbsent:do: the latter, you could call as: a with: b ifAbsent: nil do: [ ... ] -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Block and Closure
K == K K Subramaniam subb...@gmail.com writes: K In Squeak, i in the block will refer to the i in the do: block and the last K statement will print 25 because i would be 5 when do: terminates. Not necessarily. I could see an implementation where i would be 4. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] String construction and replacement
Claus == Claus Kick claus_k...@web.de writes: Claus pattern := 'HI'. Claus replacement := 'HELLO'. Claus resultString := ''. Claus i := 1. Claus answer do:[:element | (element = pattern ) ifTrue:[i = 1 ifTrue:[resultString Claus := resultString, replacement . i := i + i] ifFalse:[resultString := Claus resultString, ' ', replacement ]] ifFalse:[resultString := resultString, ' ', Claus element]]. Claus ^resultString. That sort of build a string by repeated concatenation scares me. Might be ok for very short things, but for longer things, learn to use streams. For example, look at the implementation of StringexpandMacrosWithArguments: to see how to use a ReadStream on the source and WriteStream to hold the destination. Also, if the logic gets to be nested blocks, I try to refactor that rather quickly. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] String construction and replacement
Claus == Claus Kick claus_k...@web.de writes: Claus How would you refactor something like that? If you can, get a copy of Kent Beck's Smalltalk Best Practice Patterns. But the key thing to keep in mind is that anything that isn't just a simple message send (unary, binary or keyword) has some subsequence of one or more message sends that can be pulled out and named separately with an intention-revealing selector, providing both code reuse, and clarity. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] closed and open interval
Filip == Filip Malczak [EMAIL PROTECTED] writes: Filip You can always make subclass of Interval for example OpenedInterval , add Filip two variables: left and right.Make new methods: OpenedInterval from: aNumber to: aNumber left: aBoolean OpenedInterval from: aNumber to: aNumber right: aBoolean OpenedInterval from: aNumber to: aNumber left: aBoolean right: aBoolean You're exposing implementation there. I suggest: beOpenLeft beClosedLeft isOpenLeft isClosedLeft and the corresponding right methods, rather than an explicit boolean. More flexibility later. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] closed and open interval
Bert == Bert Freudenberg [EMAIL PROTECTED] writes: Bert On 24.11.2008, at 17:46, Randal L. Schwartz wrote: Filip == Filip Malczak [EMAIL PROTECTED] writes: Filip You can always make subclass of Interval for example OpenedInterval , add Filip two variables: left and right.Make new methods: OpenedInterval from: aNumber to: aNumber left: aBoolean OpenedInterval from: aNumber to: aNumber right: aBoolean OpenedInterval from: aNumber to: aNumber left: aBoolean right: aBoolean You're exposing implementation there. Bert How so? You're requiring the user to do their own encoding of open = true, closed = false, when that's really no business of the user. And what if you decide later to encode the four combinations as a single pluggable block or symbol? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] body tag in seaside
Tony == Tony Giaccone [EMAIL PROTECTED] writes: Tony I've made a casual examination, and I can't quite figure out which component Tony creates the body tag. Tony Of course I want to be able to set the class, but what I'd really like is Tony for someone to point me to a place where I can read about how to do this? I used methods containing string on body, and found WAHtmlRoot #writeHeadOn: which appears to pick up attributes for the body tag from ivar bodyAttrs, which can be accessed in your app's #updateRoot: by sending #bodyAttributes to the passed-in root. This is an instance of WAHtmlAttributes, so you should be able to call #addClass: on it. In other words, to your top level component, add instance-side: updateRoot: root super updateRoot: root. root bodyAttributes addClass: 'yourBodyClass'. Untested. You should also subscribe to the seaside user list. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Launch a service to start the image
Hervé == Hervé Darce [EMAIL PROTECTED] writes: Hervé I want to launch at startup of the image this: I handled this by adding the startup/shutdown stuff to a class in my package that holds my WaKom initialization. The simplest version of this would be: MyClass class initialize Smalltalk addToStartUpList: self. Smalltalk addToShutDownList: self. self startUp. MyClass class startUp self start. in case I want more things here MyClass class start | ma seaside | seaside := WAKom default. ma := ModuleAssembly core. ma serverRoot: (FileDirectory default directoryNamed: 'FileRoot') fullName. ma alias: '/seaside' to: [ma addPlug: [:request | seaside process: request]]. ma documentRoot: (FileDirectory default directoryNamed: 'FileRoot') fullName. ma directoryIndex: 'index.html index.htm'. ma serveFiles. (HttpService startOn: 9090 named: 'httpd') plug: ma rootModule. MyClass class shutDown self stop. MyClass class stop HttpService allInstancesDo: [:each | each stop. each unregister]. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to create new exception
Alex == Alex Chi [EMAIL PROTECTED] writes: Alex Thanks a lot for all the information. Alex 1 more question, after create a new exception class then to use it let's say I have to define something like: Alex Then use it: Alex [SpontaneousCombustionException signal] Alex on: SpontaneousCombustionException Alex do: [:ex | Transcript show: 'Explosion detected'; cr] No, you write: [some code. that might. explode here: youKnow. andMore stuff. ] on: SpontaneousCombustionException do: [:ex | Transcript show: 'Explosion detected'; cr]. And then if any of the code you call in that first block throws a SpontaneousCombustionException, you get into your second block. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] What is the best way to generate HTML from an array of arrays
Andy == Andy Burnett [EMAIL PROTECTED] writes: Andy If there were no embedded arrays I would just do something like: Andy model do: [:each| html listItem: (each asString)] Andy But as soon as I have embedded arrays, my mind goes a bit blank and I start Andy thinking about recursive routines, and that doesn't seem very Smalltalk at Andy all! So, what is the OO way to do this? Create a visitor pattern. Teach each of strings and arrays how to present themselves. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to create new exception
Alex == Alex Chi [EMAIL PROTECTED] writes: Alex I already solved my problem. Thanks for your help. For the mailing list, and future googlers, can you post what you ended up with? In general, it's rude to ask a question, then say nevermind, I found the answer without sharing the answer. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to create new exception
Alex == Alex Chi [EMAIL PROTECTED] writes: Alex Can you give me an example on how to create new exception and call/use Alex that exception in my program? I try to googling but don't seem to find Alex one. Thanks. See if this helps. http://www.cincomsmalltalk.com/userblogs/cincom/digest?content=2001-files-exceptions It's a bit dated but it might give you the information you need. Even uses #on:do: like the ANSI standard suggests. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Callback
xyz == xyz 42 [EMAIL PROTECTED] writes: xyz Hello! I want to create a callback that will call my method after, xyz say, 10 minutes. How can I do it in squeak? Open a Transcript and a workspace, and execute this in the Workspace: [(Delay forSeconds: 10) wait. Transcript show: 'done!'] fork. Then go off and do something else for 10 seconds. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to create new exception
Alex == Alex Chi [EMAIL PROTECTED] writes: Alex As a beginner in smalltalk I have a problem on how to create new Alex exception class. For example I want to create FileNotFoundError, I have Alex create a new class FileNotFoundError uner class Error. But then I get Alex confuse where to write the description or defaultAction of my new Alex exception? Looks like both #description and #defaultAction are instance-side methods of the classes under Exception. So you'd define it as an instance-side method in your FileNotFound error. You do realize that FileDoesNotExistException already exists? Can you just use that? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] appending Strings
Mark == Mark Volkmann [EMAIL PROTECTED] writes: Mark stream := WriteStream on: ''. Mark stream nextPutAll: 'foo'. Mark stream nextPutAll: 'bar'. Mark s := stream contents s := String streamContents: [:stream | stream nextPutAll: 'foo'; nextPutAll: 'bar'. ]. Then you don't even have to name the stream, because it has that temporary name inside the block. Look for the many senders of #streamContents: as examples. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: break out of do
Nicolas == Nicolas Cellier [EMAIL PROTECTED] writes: Nicolas For the fun of it, see also Nicolas http://article.gmane.org/gmane.comp.lang.smalltalk.gnu.general/3375/match=break Oww. I remember that. It makes my head hurt. You could even go further: Object valuedEscaper: aBlock ^ aBlock value: [ :finalValue | ^finalValue ] ... found := self valuedEscaper: [:escape | 1 to: 10 do: [ :x | x = 3 ifTrue: [escape value: true]. ] false]. Oh geez. I think I just reinvented continuations. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: break out of do
Bert == Bert Freudenberg [EMAIL PROTECTED] writes: Bert That would be a perfect opportunity to employ #valueWithPossibleArgument:. And with this, the newbies heads have exploded. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] substring
Mark == Mark Volkmann [EMAIL PROTECTED] writes: Mark I can't find a method to give me a substring of a String from a given Mark index to the end. The copyFrom:to: method requires telling it the end. Mark Does a method exist where you only specify the starting point? I know I Mark could write it myself, but I don't want to do that if it's already Mark there. Look at all senders of #copyFrom:to: in the SequenceableCollection class. The one you want may already be there, just named a bit odd. In fact, there's #allButFirst: which seems to be what you want, except that it's off by one. That is, 'abcde' allButFirst: 2 would return 'cde'. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] 'locking' an object
Sean == Sean Allen [EMAIL PROTECTED] writes: Sean If you wanted to take a mutable object and make it immutable and be able Sean to go back again to mutable, how could you do that? Squeak doesn't have that sort of capability. The immutability of a few classes is because the VM recognizes them specially, and not available at the programmer level without modifying the VM. Other Smalltalk VMs are different. I think both VisualWorks and GemStone/S have primitive bits on an object to be informed when a mutation might be attempted. You can simulate that *mostly* in Squeak by using a proxy object that intercepts all messages and looks for the dangerous ones, but that's gonna be a bit hard to do, and won't be aware of any new code that might call the mutating primitives directly. (*Any* method can call a primitive.) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] 'locking' an object
Marcin == Marcin Tustin [EMAIL PROTECTED] writes: Marcin Surely if you have a wrapper class which only holds a reference to a Marcin single object that has all of the data, and that has accessors, then Marcin the wrapper can only use the accessors? The data object could have a Marcin flag that causes all of the accessors to throw an exception when it is Marcin set. Well, if everyone using the object promises to play nice, sure. But the debugger doesn't have any special privileges, and it can clearly access every inst var, regardless of whether accessors exist or not, through the magic of #instVarAt: and friends. So code would merely have to execute the equivalent of the primitives behind #instVarAt: and #instVarAt:put:, and no amount of wrapper class would help. If the problem is how do I ensure this object *doesn't* get mutated?, this is not a complete solution, just a slow simulation as long as everyone cooperates. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] 'locking' an object
Bert == Bert Freudenberg [EMAIL PROTECTED] writes: Bert There is no magic in #instVarAt:. It exists merely for helping Bert debugging. I meant the primitive it invokes. Encapsulated magic is still magic. So code would merely have to execute the equivalent of the primitives behind #instVarAt: and #instVarAt:put:, and no amount of wrapper class would help. Bert All you need to do to prevent the debugger from accessing instance Bert variables is overwriting the methods the debugger invokes. Ahh, but a determined outsider could still add methods to the class of the object on the fly, hand-compiling them if necessary. Unless you're now voting for an immutable method dictionary. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] 'locking' an object
Bert == Bert Freudenberg [EMAIL PROTECTED] writes: Bert How would that outsider get at the class of the object? I believe #class is NoLookup, meaning that I can't define a method of my own to do something weird with that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] 'locking' an object
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Randal I believe #class is NoLookup, meaning that I can't define a method Randal of my own to do something weird with that. Feh. Ignore me. I have no idea what I'm talking about. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] capturing output in memory
Mark == Mark Volkmann [EMAIL PROTECTED] writes: Mark For the purpose of writing unit tests for code that writes to a stream I Mark want to use something other than a FileStream that will allow me to Mark write to it just like FileStream, but will just hold the data in Mark memory. When I'm finished writing, I want to retrieve everything I've Mark written as a single String. Is there a class that does that? myStream = WriteStream new. use myStream as if it were a FileStream myString := myStream contents. That's the nice part about the various protocol families. It mostly just works. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] capturing output in memory
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Randal myStream = WriteStream new. Sorry. (WriteStream on: '') Randal use myStream as if it were a FileStream Randal myString := myStream contents. Randal That's the nice part about the various protocol families. It mostly just Randal works. Randal -- Randal Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Randal [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Randal Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. Randal See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] constants
Norbert == Norbert Hartl [EMAIL PROTECTED] writes: Norbert It is not called _after_ creation. You said it is just another Norbert object. And therefor it is part of the new call. The difference Norbert here is that when you create a class there is no initialize Norbert method. You define that later. So it is e.g. executed when load Norbert from Monticello or anything that creates the class at a whole Norbert including the initialize method. Norbert I hope that comes near to what happens really :) This dates back to the old .st fileins... the very last line of these fileins is SomeClass initialize, meaning that the initialize method is actually called very explicitly once the class is loaded. Modern code management systems simulate this in various ways. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] who signals?
Mark == Mark Volkmann [EMAIL PROTECTED] writes: Mark Is there an easy way to get a list of all the methods hat signal a given Mark exception class? Just browse all references to the class. That's a command-N (mac) when hovering over the class name in the second pane of a standard browser. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] who signals?
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Randal Just browse all references to the class. That's a command-N (mac) Randal when hovering over the class name in the second pane of a standard Randal browser. And when I typed N, I meant shift n :). -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Removing 'dead' instances
Andy == Andy Burnett [EMAIL PROTECTED] writes: Andy Could some kind soul please explain what I am doing wrong here? Andy I have a model, called Fspace, which I have created several instances of, Andy whilst I was testing it. Andy Fspace allInstances size reports 9 instances. Andy When I run Andy Fspace allInstancesDo: Andy[:each | Andyeach := nil. Andy Transcript show: (each value); cr. AndySmalltalk garbageCollect] Andy The transcript shows that the values are set to nil. However, the instances Andy don't go away. So, what am I doing wrong? Setting each to nil there does nothing, since you aren't updating the object that was originally in each. You need to tell anyone still holding a reference to your objects to let go. Some advice can be found at http://wiki.squeak.org/squeak/2176 -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] pretty printing
Claus == Claus Kick [EMAIL PROTECTED] writes: Claus YourClass escape: aString Claus escapes a String Claus |result| Claus result := ''. Claus aString do:[:char | result := result, char xmlEscaped]. Claus ^result This is an expensive way to build a string. #collect: would be better: aString collect: [:char | char xmlEscaped]. Internally, that uses a Stream, which extends itself nicely as new data appears. In your version, the early string data is getting repeatedly copied to make each new string. Ouch. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] dev image OB Package Browser
Rob == Rob Rothwell [EMAIL PROTECTED] writes: Rob world menu-open...Preference Browser. Got to developer image category Rob and disable ecompletionSmartCharacters yeah, that drives me nuts too. I think if you're a fast typist or not used to it, it gets in the way. I mean, in *theory*, if you used it, it would save you about 1-2 characters of typing per line. But I usually get those typed without noticing anyway. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Removing 'dead' instances
Andy == Andy Burnett [EMAIL PROTECTED] writes: Andy I was wondering exactly that myself. After my 'doh!' moment, when Randal Andy explained what I was doing wrong, I was trying to work out why I had made Andy the mistake. The conclusion I came to was that I was becoming so used to Andy sending messages to objects, that I had confused myself into thinking that I Andy was somehow sending 'become nil' to the object stored in :each. In a system where #become: is a two-way swap, rather than one-way, you *never* want to send become: nil. That'd break everything, since now the value of nil would be your other object. :) The safe way to become: something innocent is often become: String new. Even so, it's (a) very slow on Squeak and (b) a bit shocking to the holder of the value, who still expects the old object at its referenced oop. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] scripts
Bert == Bert Freudenberg [EMAIL PROTECTED] writes: Bert Am 26.09.2008 um 05:12 schrieb Mark Volkmann: Is it possible to run a Squeak program from a terminal window and have access to the stdin and stdout streams from the Smalltalk code? Bert Yes. If so, pointers to documentation on this would be much appreciated. Bert http://wiki.squeak.org/squeak/708 That's for Squeak creating child processes. I *think* the question is more along the lines of: http://wiki.squeak.org/squeak/425 as in, how can I run Squeak from a command line, and get access to the command-line arguments? The longer answer is that we generally *don't* do that, so there's not a lot of discussion or support for it, but there it is. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] scripts
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Bert == Bert Freudenberg [EMAIL PROTECTED] writes: Bert Am 26.09.2008 um 05:12 schrieb Mark Volkmann: Is it possible to run a Squeak program from a terminal window and have access to the stdin and stdout streams from the Smalltalk code? And the longer still answer (now that I've noticed access to stdin and stdout) is to use an image with OSProcess loaded, and then you can get access as follows: me := ThisOSProcess thisOSProcess. stdin := me stdIn. acts like a Stream stdout := me stdOut. stderr := me stdErr. stderr print: Time now; cr. put the time of day on my stderr output -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] squeak startup script
Mark == Mark Volkmann [EMAIL PROTECTED] writes: Mark I see discussions on the web about starting squeak from a terminal Mark window using squeak -headless, but I don't have a squeak script. Mark which squeak turns up nothing. I'm using Squeak3.10.2. Where can I get Mark that startup script? If you navigate with your Terminal.app inside your installed VM, you'll see inside the .app directory a subdirectory called Contents, and below that a MacOS, and below that an executable. That executable can be hardlinked to anywhere in your $PATH (like /usr/local/bin) as the name squeak, and it it will work as advertised for unix platforms. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] names for boolean keyword arguments
Norbert == Norbert Hartl [EMAIL PROTECTED] writes: Norbert There is no strict rule to it but I think here the majority Norbert follows some hint what to expect rule. That means you name Norbert the argument after the class of the argument. Norbert expensive: anExpensive If I recall, according to Smalltalk Best Practice Patterns (the seminal patterns book for Smalltalk), you want the attribute to be of the form isProperty: isExpensive := true. which means that expensive: shouldn't be a setter. In fact, said book states that you should have be methods: anObject beExpensive anObject beCheap which would likely set isExpensive to true and false respectively, perhaps, or even 2 states out of a 3-state variable. Encapsulation! Because then you also have tests: anObject isExpensive ifTrue: [ ... ] or even (if you use it a lot): anObject ifExpensive: [ ... ] I've often argued that automatic creation of getters and setters is wrong. This is clearly an example of where automatic getters and setters lead you to bizarre code. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] enumerated values
Mark == Mark Volkmann [EMAIL PROTECTED] writes: Mark Is there an equivalent of Java's enumerated values (enum) in Smalltalk? I hope not! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Collection in Smalltalk
Alex == Alex Chi [EMAIL PROTECTED] writes: Alex So for example if the input is 'SmallTalk' the result is ('SmallTlk' Alex 'SmllTlk'). Presuming the input came from someone who didn't know that Smalltalk doesn't have a capital T. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Most elegant way to delete instances
Giuseppe == Giuseppe Luigi Punzi Ruiz [EMAIL PROTECTED] writes: Giuseppe I need to delete all the instances of a class. I would like to know, wich is Giuseppe the best way to do this. Giuseppe I'm trying this: Giuseppe IGCompany allInstances do: [ :each | each := nil]. Giuseppe But this, doesn't works. Giuseppe All help is appreciated. each := nil changes the local variable each from containing an instance of IGCompany to holding nil. That doesn't do anything to the original instance. You need to find all of the objects *holding* these IGCompany instances and tell them to let go. Once everyone has let go of all of them, then the next garbage collection pass will see that nobody is pointing to them, and get rid of them. In normal programming, this should just happen naturally. The larger question is, why do you care? I hope you're not writing code that looks like IGCompany allInstances for *real* code. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Host OS shell call
Steve == Steve Lloyd [EMAIL PROTECTED] writes: Steve Is there a Squeak class to allow calling a shell command in the host OS Steve and receiving the result? Yes, it's called OSProcess (I think), and is installable from SqueakMap or Universes. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Passing multiple parameters.
Charles == Charles Gray [EMAIL PROTECTED] writes: Charles Is it possible to pass multiple parameters to a method? Suppose I want Charles to have a method that solves for x in the quadratic equation, ax^2 + Charles bx +c =0. We know the equation is ((-b + (b*b -4*a*x) sqrt))/(2*a). I Charles want to pass a, b, and c to a method that might be called Charles quadraticSolution. This is a hypothetical question but its answer will Charles help me with something on which I am working. The method name reflects the number of parameters: anObject unaryMessage. unary message takes no parameters anObject + anotherObject. binary message is punctuation, takes one parameter anObject takes: aParameter and: anotherParameter keyword message A keyword message takes one parameter following each colon-terminated word. In this case, the name of the message is takes:and:. For a solver, you'd probably have: result := theSolver solveQuadraticEquationForA: a andB: b andC: c. or something like that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Arrays within arrays
Charles == Charles Gray [EMAIL PROTECTED] writes: Charles strength := Array new: 10. You don't need to do that, if you're doing this: Charles strength := #( #(0 0 0 0) #(0 0 0 0) #(0 0 0 0) #(0 0 0 0) #(0 0 0 0) #(0 0 0 0) Charles #(2 1 0 0) #( 8 4 0 1) #(14 6 0 2) #(30 12 1 4)). And that works for me. What version are you using? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Smalltalk is a Mystery to Me
Todd == Todd Blanchard [EMAIL PROTECTED] writes: Todd And I'd guess you just totally blew the newbies input buffer with Todd conceptual overload when he was just trying to get one thing working. I'm of the belief that you don't show people bad style, no matter what their level, and especially newbies, because they tend to fall back on what they learn first. Perhaps we differ in our experience, but I have plenty of experience of this from my Perl course presentations. At a minimum, you say an experienced user would probably have put these into a Collection, and you'll want to learn about those pretty soon, as nearly every class uses a Collection of some kind. Using separate variables in place of a collection often leads to mindless cut-and-paste-and-slightly-edit code replication, and/or people asking how do I turn a string into a variable name. Again, from experience. These are not behaviors you want to encourage in a newbie. :) Admittedly, I should have done something less Smalltalk idiomatic: hands := IdentityDictionary new. hands at: #north put: Set new. hands at: #east put: Set new. hands at: #west put: Set new. hands at: #south put: Set new. hands at: #trick put: Set new. Eventually, the newbie can learn that the cut-n-paste-and-slightly-edit that I just did to make that can be replaced by a proper loop. But at least that cut/paste cycle won't be repeated everywhere else in the code. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Smalltalk is a Mystery to Me
Todd == Todd Blanchard [EMAIL PROTECTED] writes: Todd north := OrderedCollection new. Todd south := OrderedCollection new. Todd east := OrderedCollection new. Todd west := OrderedCollection new. Todd trick := OrderedCollection new. It's been my observation that similarly named variables that are acted upon in similar ways really ought to be part of a common data structure rather than unrelated variables. hands := IdentityDictionary newFrom: (#(north east south west trick) collect: [:each | each - Set new]). -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] The Weekly Squeak Summary No. 19: May 4 - Aug 16, 2008
Michael == Michael Haupt [EMAIL PROTECTED] writes: Michael Dear Squeakers, Michael welcome to this edition of The WeeklySqueakSummary, an irregular Michael traffic-dependent report on what's going on in the world of Squeak Michael based on the WeeklySqueak blog. It's been a rather long time since the Michael last issue because I've been on parental leave for two months... Michael anyway, here we go again with a slightly longer e-mail than usual. If you want an audio version of this, subscribe to the weekly Industry Misinterpretations podcast. I provide a segment for that podcast each week where I read the week's Squeak news. It's usually near the end if you aren't interested in the rest of the podcast, but I suggest you listen to the entire podcast anyway, as it covers a wide variety of smalltalk topics. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Why do Seaside's table tags e.g. td etc., live 'outside' of table?
Andy == Andy Burnett [EMAIL PROTECTED] writes: Andy I was looking at some Seaside code today and noticed that it said Andy html tableCaption: 'blah'. Andy Rather than Andy html table tableCaption: 'blah' Andy I am keen to understand what makes good Smalltalk design, so could someone Andy explain why making the tags independent is a better way of doing it? Probably for the same reason that list-element tags live outside lists, and paragraphs live outside headings and body. All tags are essentially flat, except for the oddballs for options and optiongroups, because they really are aspects of the canvas, not of the parent tags. A table tag shouldn't know how to render a tablecaption tag. It's the canvas that knows how to render both. Therefore, you have to ask the canvas for a tag brush each time. Don't confuse composition with locale of knowledge. Now, you *could* enhance all of the tags to know about all their possible child tags, but that would just make the code unwieldy, I think, since they would end up looking like this: WATableBrushtableCaption ^self canvas tableCaption WATableBrustableCaption: aRenderable ^self canvas tableCaption: aRenderable Now there are clearly some shortcuts that already do this, but to require this enmasse doesn't seem to gain much. The always ask the canvas for a tagbrush seems like a very workable rule. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Tim's Fix for LargeIntgerAtRandom
Jerome == Jerome Peace [EMAIL PROTECTED] writes: Jerome So what do you suggest to solve the problem? Use the code from the Crypto team. If you want that included in the core, make sure it has an MIT license, and submit it as a bug/change-request. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Can Seaside applications support REST style calls?
Andy == Andy Burnett [EMAIL PROTECTED] writes: Andy So, I need to provide some URL handling on the server side. Is there a Andy object I should use for this? This is a FAQ. The beginnings of the answer are at http://seaside.st/documentation/naming-urls. If you read that, then do some googling of those particular method names, you'll get a lot of examples of how to use them. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Is it generally considered better practice for an object to access its own variables via its getter methods?
Andy == Andy Burnett [EMAIL PROTECTED] writes: Andy I noticed that the Seaside tutorial has code such as: Andy html div class: 'menu'; with: self menuComponent. Andy Whereas the Scriptaculous demo code does things like this: Andy html paragraph id: 'position'; with: position. Andy I.e. they didn't bother adding (or using) a getter for position. Who is Andy right, or doesn't it matter, or is there another reason why it would be Andy written differently? Clearly, position is an instance var, or perhaps a temporary. An instance var may or may not have accessors, depending on whether it is meant to be tweaked from the outside. #menuComponent, on the other hand, may be just an accessor, or it may be a whole pile of code to generate that menu on the fly. At this point, it doesn't matter. Whether internal accesses to instance vars should use accessors instead of direct access is a subject to debate (read: religious war). I hope you haven't accidentally triggered that thread here. I tend to do the simplest thing that works, and leave it at that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] true/false defined where?
Sean == Sean Allen [EMAIL PROTECTED] writes: Sean I have a feeling the secret to unraveling that confusion comes from this: Sean 'true and false and some of the very few objects known to the VM' Sean does that mean that I can't go and find these variables anywhere? that Sean they arent true global variables they are some sort of special global? If you explore Smalltalk specialObjectsArray, you'll see a special list of variables that both the VM and the Smalltalk code have to agree on in order to run. For example, if a primitive wants to return false, it has to know what the rest of the Smalltalk image considers the sole instance of the False class. These items are established in SystemDictionary#recreateSpecialObjectsArray, the first version of which had to be executed essentially by hand on the first VM (either the early versions of Smalltalk 76 or 80). Since then, this special array has gotten its initial values by running it in an already running system, so the first few entries there (nil, false, true) are in fact clones of clones of clones of the original handcrafted objects. Of course, there's code on the VM side that knows the precise order of this magical array, and this is what allows them to communicate, so you can't just add new things here or change the ordering without building a corresponding new VM. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: Tim's Fix for LargeIntgerAtRandom
Jerome == Jerome Peace [EMAIL PROTECTED] writes: Jerome The objection Randal raised is that now it is using too many. Jerome That's IMO a red herring. No, it's not. Multiple calls to a PRNG generate correlated numbers, which can be used for an attack. You need to use a PRNG that in a single call gives enough bits. And if you don't know that about PRNGs, you're not the one to be fixing this. I talked about it in terms of entropy because that's the easiest way to see that you're not gaining anything except the illusion of gain, which will bite back some day. You can't get 112 bits of entropy by calling a 56-bit PRNG twice. It's not progress if it breaks it. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: What's wrong with this statement?
Cerebus == Cerebus [EMAIL PROTECTED] writes: Cerebus Attached is a new IntegeratRandom I'm playing with. I break the Cerebus integer into a ByteArray and call #atRandom for every byte, using 255 Cerebus as the bounding value for all but the first byte. The bounding value Cerebus for the first byte is itself minus 1. Concatenated together we get a Cerebus byte array representing a random value less than the bounding value. You're going to get a correlation at some point. You're merely spreading the same amount of entropy around in different places. It's not more random. Look at it this way. The cycle will repeat in 2**53 calls to the random number generator. By calling it 10 times for each result, you're using causing it to loop 10 times as fast. You can't get 10 pounds of entropy out of a 5 pound sack. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Best place to ask Smalltalk questions?
Sean == Sean Allen [EMAIL PROTECTED] writes: Sean If I have beginner Smalltalk questions. What is the best forum for Sean asking those? Sean Here even if they aren't squeak specific? If you're learning Smalltalk by using Squeak, it makes sense to ask them here. If you're not using Squeak to learn, it might be best to start with an appropriate list for that vendor, simply because you might not know whether it's Squeak-specific or not. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] What's wrong with this statement?
Timothy == Timothy J Miller [EMAIL PROTECTED] writes: Timothy (2 raisedTo: 128) atRandom hex Timothy Gives me results like: Timothy B990880B73211001 Timothy BFD3A7B37FA75001 Timothy E0A6F981C14DF001 Timothy Somehow I'm not buying the lower-order bits on this one. :) It's pretty likely you have a 16-bit random generator, so there just aren't enough bits to make the low-order bits random in any way shape or form. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] What's wrong with this statement?
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Timothy == Timothy J Miller [EMAIL PROTECTED] writes: Timothy (2 raisedTo: 128) atRandom hex Timothy Gives me results like: Timothy B990880B73211001 Timothy BFD3A7B37FA75001 Timothy E0A6F981C14DF001 Timothy Somehow I'm not buying the lower-order bits on this one. :) Randal It's pretty likely you have a 16-bit random generator, so there just aren't Randal enough bits to make the low-order bits random in any way shape or form. Err, uh, 64 bits of random. But still not enough for a 128-bit random number. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: What's wrong with this statement?
Timothy == Timothy J Miller [EMAIL PROTECTED] writes: Timothy It certainly is inconsistent to have an Integer method that doesn't Timothy invisibly handle large ints. The Integer method is fine. The problem is the lack of bits from the PRNG from class Random. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] What's wrong with this statement?
johnps11 == johnps11 [EMAIL PROTECTED] writes: johnps11 I'm not clever enough to understand PRNGs, so I'll leave it others johnps11 to work out what the answer is, although I suspect that for more johnps11 than 56 bits you need a PRNG that uses LargeIntegers and not Floats. Yes. There are only 56 bits in an IEEE Float. You can't get any more random bits from that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to shorten a method (using inject: into: ?)
cdrick == cdrick [EMAIL PROTECTED] writes: cdrick Always choose the most readable (before optimizing) and to me, the cdrick following is much more readable: cdrick mTotal := (testSets collect: [:each | each maternalCount]) sum. cdrick pTotal := (testSets collect: [:each | each paternalCount]) sum. Well, the #detectSum: solution is even cleaner. :) mTotal := testSets detectSum: [:each | each maternalCount]. It's just a horribly named method, which is why I didn't find it at first. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to shorten a method (using inject: into: ?)
K == K K Subramaniam [EMAIL PROTECTED] writes: K Entering sum in a new line in workspace or text object and then pressing K ALT+SHIFT+W would have revealed detectSum: (it is eleventh in my list). Yeah, I looked near the implementation of #sum instead. Ooops. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: How to shorten a method (using inject: into: ?)
Zulq == Zulq Alam [EMAIL PROTECTED] writes: Zulq Yes, it's not a good idea to couple your classes with others for frivolous Zulq reasons. I just wanted to see how tersely it could be expressed with Zulq #inject:into:. And now I hope you see why I say that #inject:into: is both overutilized and underutilized. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: How to shorten a method (using inject: into: ?)
Zulq == Zulq Alam [EMAIL PROTECTED] writes: Zulq Hi Stan, Zulq How about using #detectSum:? Zulq testMaleMeiosis2 Zulq pTotal := Forecaster testMale meiose Zulq detectSum: [:strand | strand testRun paternalCount]. Zulq mTotal := Forecaster testMale meiose Zulq detectSum: [:strand | strand testRun maternalCount]. Zulq self should: [mTotal = 100 and: [pTotal = 100]] Huh? Why the heck is that called #detectSum: instead of just #sum:? I was trying to find that. That'd shorten my previous one even more: testRuns := Forecaster testMale meiose collect: [:e | e testRun]. pTotal := testRuns detectSum: [:e | e paternalCount]. mTotal := testRuns detectSum: [:e | e maternalCount]. No redundant calculations, although we're building an array in the middle that will be a throwaway. /me makes a note to look under #detectFoo: next time -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: How to shorten a method (using inject: into: ?)
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Randal Huh? Why the heck is that called #detectSum: instead of just #sum:? [...] Randal /me makes a note to look under #detectFoo: next time In fact, now that I look at it, it's really not like #detectMax:, which returns the *original* element that is the max, or #detect:, which returns an *original* element that meets a test. It's transformational, more like #collect. But since #sum already does that, it really should have simply been named #sum:. Sigh. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] What is a weak reference
Herbert == Herbert König [EMAIL PROTECTED] writes: Herbert Hello cdrick, c All that sounds like don't use weak reference :) Herbert unless you know exactly what you are doing. One possible use I haven't seen in this thread is to keep notes on a class you don't own (and don't want to change), without preventing them from being GC'ed normally. For example, if I wanted to write a system watcher that noticed the comings and goings of Process objects, I'd likely keep a Dictionary keyed by the Process instance referencing the data of start times. However, I wouldn't want that key to keep the Process instance from being gc'ed, so I'd use a weak dictionary. This is how the classic dependents system works as well: the dependencies are in a WeakDictionary so that when the watched object goes away, the dependencies are also cleaned. The alternative is to add a set of properties to the Process that others can stuff information, so that Process allInstances can get my process watcher what it needs instead. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Re: What is a weak reference
nicolas == nicolas cellier [EMAIL PROTECTED] writes: nicolas But maybe we have just quit the beginners rails... I think the moment you mention Weak, you're already outside beginner space. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] What is a weak reference
Michael == Michael Davies [EMAIL PROTECTED] writes: Michael I note that there are very few uses of any Weak* classes in the image, Michael so it's likely that there is a better way of implementing what you're Michael aiming for; eg the child could drop its direct parent reference, and Michael do something like Child parent Michael ^ Parent allInstances detect: [ :each | each children includes: self ] Michael (or vice versa depending on which way you're more likely to traverse Michael the relationship). I'd argue though that a solution that involves #allInstances has a bit of code smell. For example, consider an XML node, looking for its parent. In a given parsed document, you'll likely have thousands of nodes, and it would be clearly inefficient to continually find the one parent by asking all of them. In that case though, weak refs probably weren't needed anyway, since each node can just contain its parent. Michael This is just me thinking out loud though - perhaps someone else could Michael comment on best practice in this case. Smalltalk Best Practice Michael Patterns is very useful in answering these types of questions, but my Michael copy is in a box somewhere at the moment. Absolutely. A clearly seminal book. My dog-eared copy is within reach, at least when I'm in my home office. Too bad Kent has gone off to the Java, and now C# realm, if I heard right. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] new Smalltalk videos
stephane == stephane ducasse [EMAIL PROTECTED] writes: stephane I started to redo my old Smalltalk videos and I would like to get stephane some feedback before putting a soundtrack in french and english. I stephane will be looking for somebody with a good english accent and a mac to stephane help for the english soundtracks. By English Accent, do you mean someone who sounds like Ricky Gervais? That's what we in the states call that. :) Or do you just mean can speak well using the English language? If the latter, I'd be willing to loan my golden throat to the cause, and yeah, I have a mac, and a good mike setup. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners