[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[plt-scheme] Another newbie programming problem (MzScheme)
Hello,
I'm stuck again with a problem, due to extensive lack of Scheme
programming experience. This time, I need to introduce top-level
class definitions by template. Here's a sample how I would introduce
top-level definitions:
(require (lib "class.ss"))
(define (test)
(let ((df-expr
'(define testclass% (class* Object% ()
(public hello)
(define (hello)
(display "hello world"))
(super-instantiate ())))))
(eval df-expr (interaction-environment))))
This seems to work.
1st Question: Does this really work, or does it just seem to work by chance?
Anyway, I have a whole bunch of class-names, their properties, their
methods and super classes and so on. Now I need to 'fill' each of
these class-defining data into a general class template that later
gets defined in the above way on demand.
2nd Question: Is there a relatively easy way to do this? What's the
right approach?
Perhaps I should mention that I've read the MzScheme manual chapters
about syntax patterns and pattern matching, but wasn't yet able to
fully grasp them. That's why I ask.
Best regards,
Erich