Getting Squeak to write Squeak (a feeble effort at LISPY stuff)

Ned Konz ned at bike-nomad.com
Mon Nov 17 05:13:12 UTC 2003


On Sunday 16 November 2003 8:25 pm, mwgrant2001 wrote:
> " Select lines 1-4 and 'do it', then 'print It on last two :"
>   ans _ FillInTheBlank request:'Code?'.  
>   ans _ FillInTheBlank request:'Code for new TextMorph'.
>   ans  'c _ TextMorph new.'
>   Compiler evaluate: ans.
>   ans  'c _ TextMorph new.'
>   c nil
>
> * Note _ is of course :=
>
>  
> Any suggestions? (Still on lower part of learning curve). FYI as an
> excercise I working toward a simple app. to create an influence
> diagrams and subsequently evaluate decision trees.

I don't understand why you need to do assignments.

Can't you just do something like:

	myMorph _ Node named: answer asSymbol.

where the #named: message is setting state in the Node?

More generally, look at the bigger picture: as you create these things, 
something's got to hold onto them or they won't continue to exist.

So the assignment of 
	c := TextMorph new

just doesn't make any sense here.

Going a bit further, if you look at the various flavors of #evaluate: you will 
find some where you can specify a context in which to do the evaluation. For 
instance, Workspaces hold variable bindings, and will provide them when and 
if the Compiler needs them (see #bindingOf:).

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list