[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Me no understand scoping
From: |
Neil Jerram |
Subject: |
Re: Me no understand scoping |
Date: |
Fri, 8 Aug 2008 21:54:51 +0100 |
2008/8/2 Maciek Godek <address@hidden>:
>> 1. IMO this could be really beautifully done in GOOPS, by defining
>> custom metaclasses and slot types.
>
> I've been considering that, and I'm still having doubts.
> The main reason is that there's no documented way
> of accessing GOOPS objects from C (except from using
> scm_c_eval_string etc.), or at least I couldn't find any
> documentation for that.
Yes, that's a fair point. And one that keeps coming up. I hope we
can remedy this some time soon.
> Besides (which is the matter of personal taste), I don't
> like the idea of using generics and trashing the global
> namespace with them. (I mean, the sole idea of generics
> is fine, but I wouldn't want to be forced to use them)
They can of course be confined to modules, like any other names.
> I also get this unpleasant feeling that all these 'getters'
> and 'setters' are entities multiplied beyond necessity
> (even the infamous C++ doesn't explicate them)
I don't understand you here. And in any case, getters and setters are
optional. You can just use slot-ref and slot-set! if you prefer.
> I'm really trying to get close
> to the classical OOP notation: object.method() -- and
> it's probably why I explore the potential of using these
> "poor man's objects"
Unfortunately that's only "classical" for non-Lisp-like languages!
Still, I'd take your point if you said you wanted to write something
that would be familiar to OO programmers in non-Lisp languages.
> But the point is that I saw that there is a 'make-hash-table' function
> available in lisp -- and this lead me to the conclusion that it's probably
> because the scopes/closures/environments implicitly use hash
> tables to store their bindings
Right (more or less).
> (and the same mechanism was given
> explicitly to the programmer).
You mean in the sense that can one create and manipulate a hash table
where the keys are symbols? I'd certainly agree with that.
> And so I never stopped to believe that (define x 5) is more or
> less equivalent to (hash-set! global-scope 'x 5).
Well yes.... but I'm afraid I'm still not sure how that leads us to
local-eval ! Sorry if I'm being dumb about this!
Regards,
Neil