[Newbies] Re: if absent put nil (Riaan)

Klaus D. Witzel klaus.witzel at cobss.com
Wed Aug 6 12:11:36 UTC 2008


On Wed, 06 Aug 2008 13:47:39 +0200, Riaan van Aarde wrote:

> I have the following code
>
> renderAttendeesOn: html
> 	self workSession attendees do: [:each | html text: each person
> displayString]
> 			separatedBy: [html text:'; '.]
>
> if there is no attendees for my worksession, it needs to display : NO
> ABSENTEES.

You can assign subexpression (self workSession attendees) to a temporary  
variable wsa and after the statement (wsa #do: ...) have another statement  
like this
   wsa ifEmpty ifTrue: ["what you would like to do if there is no  
attendees"].

HTH.

/Klaus

> Please assist.
>
> -----Original Message-----
> From: beginners-bounces at lists.squeakfoundation.org
> [mailto:beginners-bounces at lists.squeakfoundation.org] On Behalf Of
> beginners-request at lists.squeakfoundation.org
> Sent: 05 August 2008 07:33 PM
> To: beginners at lists.squeakfoundation.org
> Subject: Beginners Digest, Vol 28, Issue 6
>
> Send Beginners mailing list submissions to
> 	beginners at lists.squeakfoundation.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.squeakfoundation.org/mailman/listinfo/beginners
> or, via email, send a message with subject or body 'help' to
> 	beginners-request at lists.squeakfoundation.org
>
> You can reach the person managing the list at
> 	beginners-owner at lists.squeakfoundation.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Beginners digest..."
>
>
> Today's Topics:
>
>    1. true/false defined where? (Sean Allen)
>    2. Re: true/false defined where? (Derek O'Connell)
>    3. Re: true/false defined where? (Michael Rueger)
>    4. Re: true/false defined where? (Sean Allen)
>    5. Re: true/false defined where? (Randal L. Schwartz)
>    6. Re: true/false defined where? (Sean Allen)
>    7. Re: Problems getting started with OpenGL in Squeak (Ken G. Brown)
>    8. Fighting again with MC (Giuseppe Luigi Punzi)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 5 Aug 2008 08:48:24 -0400
> From: Sean Allen <sean at monkeysnatchbanana.com>
> Subject: [Newbies] true/false defined where?
> To: "A friendly place to get answers to even the most basic questions
> 	about	Squeak." <beginners at lists.squeakfoundation.org>
> Message-ID:
> 	<D11C3226-D6E5-4E84-A536-91AF90B689DC at monkeysnatchbanana.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> where do true and false spring into existence?
>
> i've been poking around and cant figure it out.
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 5 Aug 2008 13:53:18 +0100
> From: "Derek O'Connell" <doconnel at gmail.com>
> Subject: Re: [Newbies] true/false defined where?
> To: "A friendly place to get answers to even the most basic questions
> 	about	Squeak." <beginners at lists.squeakfoundation.org>
> Message-ID:
> 	<1091398f0808050553o68e1afe8ybcc70c4083dc7429 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Have a look in Kernel-Objects
>
> On Tue, Aug 5, 2008 at 1:48 PM, Sean Allen <sean at monkeysnatchbanana.com>
> wrote:
>> where do true and false spring into existence?
>>
>> i've been poking around and cant figure it out.
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 05 Aug 2008 14:54:45 +0200
> From: Michael Rueger <m.rueger at acm.org>
> Subject: Re: [Newbies] true/false defined where?
> To: "A friendly place to get answers to even the most basic questions
> 	about	Squeak." <beginners at lists.squeakfoundation.org>
> Message-ID: <48984D95.10509 at acm.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Sean Allen wrote:
>> where do true and false spring into existence?
>
> They have been around longer than some people on this mailing list ;-)
>
>> i've been poking around and cant figure it out.
>
>
> true and false and some of the very few objects known to the VM and they
> where instantiated when the parent of all current images was created.
> All images are basically cloned and not re-created from source, and
> that's why you don't see any initialization code for them, they just  
> "are".
>
> Hope this doesn't add to any confusion...
>
> Michael
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 5 Aug 2008 09:09:01 -0400
> From: Sean Allen <sean at monkeysnatchbanana.com>
> Subject: Re: [Newbies] true/false defined where?
> To: "A friendly place to get answers to even the most basic questions
> 	about	Squeak." <beginners at lists.squeakfoundation.org>
> Message-ID:
> 	<FA50326D-974B-48E4-A940-835C0664C75B at monkeysnatchbanana.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
> On Aug 5, 2008, at 8:54 AM, Michael Rueger wrote:
>
>> Sean Allen wrote:
>>> where do true and false spring into existence?
>>
>> They have been around longer than some people on this mailing list ;-)
>>
>>> i've been poking around and cant figure it out.
>>
>>
>> true and false and some of the very few objects known to the VM and
>> they where instantiated when the parent of all current images was
>> created.
>> All images are basically cloned and not re-created from source, and
>> that's why you don't see any initialization code for them, they just
>> "are".
>>
>> Hope this doesn't add to any confusion...
>
> How is this for a confusing answer... it both does and doesnt.
>
> I have a feeling the secret to unraveling that confusion comes from
> this:
>
> 'true and false and some of the very few objects known to the VM'
>
> does that mean that I can't go and find these variables anywhere? that
> they arent true
> global variables they are some sort of special global?
>
>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 05 Aug 2008 07:52:50 -0700
> From: merlyn at stonehenge.com (Randal L. Schwartz)
> Subject: Re: [Newbies] true/false defined where?
> To: Sean Allen <sean at monkeysnatchbanana.com>
> Cc: "A friendly place to get answers to even the most basic questions
> 	about	Squeak." <beginners at lists.squeakfoundation.org>
> Message-ID: <86pron3459.fsf at blue.stonehenge.com>
> Content-Type: text/plain; charset=us-ascii
>
>>>>>> "Sean" == Sean Allen <sean at monkeysnatchbanana.com> 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.
>




More information about the Beginners mailing list