A stupid newbie question

Ned Konz ned at bike-nomad.com
Sat Oct 6 19:48:34 UTC 2001


On Saturday 06 October 2001 11:42 am, Patrick Castle wrote:

> ..a String is bound to the aPoint variable.
>
> As part of the move's validation process a method is used to determine
> firstly whether the user has actually entered a point and secondly whether
> the point is valid. But it won't even pass the    aPoint isKindOf: Point

> This binds a Point instance to aPoint which is the desired outcome.
> However, I don't personally think the workaround is very acceptable. For a
> start I could enter 'Johnny Rotten' and the application would happily
> convert my answer into a Point instance which I think is very sloppy. I
> would need an extra layer of validation to stop this. Mind you - any string
> other than the legal values for the game will come up with an 'illegal
> move' response (or at least they seem to).
>
> So my question is how to a turn a String response '1 at 1' into Point instance
> 1 at 1? 

Try:

Compiler evaluate: '1 at 1'

> And it actually opens up a larger question for me. Using
> FillInTheBlank, how to I return anything other than String objects? From my
> example it seems that if I had used the class to prompt me for a number I
> would be return '5' rather than 5, which isn't much use if I'm wanting to
> make calculations with the answer.
>
> I know the answer would have to be very simple, but I just haven't found
> the solution in the class library yet, or any tutorials or books I have.

FillInTheBlank returns Strings. Then you convert them. There are conversion 
methods in String (as*) and in some of the other classes, like 
Date>>fromString: or Number>>readFrom: .

> Just to try your patience I thought I'd add another question.
>
> Now that I have the application functioning I would like to make it into an
> .exe file to see how it functions outside of the Squeak development
> environment. The only info I've found so far on doing this is to type:
>
> CCodeGenerator new initialize addClass: ClassName) codeString.
>
> Inspecting this gives me some C code with an #include 'sq.h'  line in it. I
> don't have this header file so where would I get it? Is this all I need to
> do to turn a Squeak application into an .exe?

No. Squeak apps don't willingly turn into exes. They would require the entire 
VM, and the image itself, or at least the parts of it that were needed.

PhiHo Hoang has recently posted a method to make single exe's under Windows. 
However, the base image doesn't have (as far as I know) any way to do this, 
yet, or especially portably.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list