I've spend the better time of the afternoon with trying metaprogramming
with Smalltalk I finally have come up with:
asciiNames := Array withAll: #(#nul #soh #stx #etx #eot #enq #ack #bel #bs #tab
#lf).
i := 1.
asciiNames
do: [ :each |
self class compile: each asString , ' ^ asciiField at:
', i asString.
i := i + 1 ].
which at least does what I want given names to ASCI Codes. Now
I have to admit I dislike this stuff with putting a string togehter and
run compile: on this string.
I'm sure there is a more elegant way. Would you mind to lend me a hand?
Yes and because I think I will need much more code generation in the
near future. Does you have nice Tutorial, Book whatever to do such kind
of jobs in Smalltalk I've quite a lot of books about Smalltalk but none
has this as theme... So it's really a bit hard to get into it....
Regards
Friedrich
--
Q-Software Solutions GmbH; Sitz: Bruchsal; Registergericht: Mannheim
Registriernummer: HRB232138; Geschaeftsfuehrer: Friedrich Dominicus