Discussion:
LAYER-NAME vs LAYER in ADJOIN-LAYER/REMOVE-LAYER.
Drew Crampsie
2009-06-24 16:06:30 UTC
Permalink
Hello,

I'm sure i'm abusing contextl in some way (anonymous layers that
themselves are layered classes), but for my code to work the call to
ADJOIN-LAYER in REMOVE-LAYER-USING-CLASS must pass the layer directly
to ADJOIN-LAYER, not indirect through the layer name.

In other words :

hunk ./cx-layer.lisp 103
- (layer-name active-layer)
+ active-layer

This works for me and passes all the tests, but i'm not sure if it's
the right thing to do... i'm likely abusing contextl in many ways ;).

Cheers,

drewc
Pascal Costanza
2009-07-02 12:19:45 UTC
Permalink
Hi there,

Sorry for the late reply, we're pretty busy around here with some last
project proposal writing before the summer holidays.

I understand your concern, and the suggested fix certainly makes it
work. However, it's not so nice, because this will needlessly
increases the cache sizes, because every named layer may end up twice
in the caches, once based on the names, and once based on the
metaobjects.

I see two ways out: Either I use the metaobjects everywhere, and use
the names only for the user-level macros (which expand into code that
converts the names into metaobjects as soon as possible.

Or I make sure that anonymous layers have unique names as well: At the
moment, their names are 'nil, but I could use the metaobjects
themselves as 'names'. (For example, (layer-name #<STANDARD-LAYER-
CLASS NIL 21ECFE23>) => #<STANDARD-LAYER-CLASS NIL 21ECFE23>.

The first option may conceptually be cleaner, but requires more work
and may potentially break some existing code (not sure about the last
point, but my gut feeling tells me that there are some potentially
problematic corner cases waiting for me if I go down that path).

The second option is relatively easy to do. It may still require a
couple of changes here and there, but I don't expect any serious
problems. Somehow, I prefer that you can use the layer names in the
functional API (adjoin-layer, remove-layer, ensure-active-layer, and
friends).

Does anybody have any strong opinions about this?

Anyway, thanks a lot for raising this issue, I wouldn't have noticed
that problem otherwise. The ContextL MOP is the least polished part of
ContextL, so such feedback is especially useful. May I ask what you
are actually using this for? (I like abuses of language constructs,
this usually gives hints for new ideas for missing features...)

Best,
Pascal
Post by Drew Crampsie
Hello,
I'm sure i'm abusing contextl in some way (anonymous layers that
themselves are layered classes), but for my code to work the call to
ADJOIN-LAYER in REMOVE-LAYER-USING-CLASS must pass the layer directly
to ADJOIN-LAYER, not indirect through the layer name.
hunk ./cx-layer.lisp 103
- (layer-name active-layer)
+ active-layer
This works for me and passes all the tests, but i'm not sure if it's
the right thing to do... i'm likely abusing contextl in many ways ;).
Cheers,
drewc
_______________________________________________
closer-devel mailing list
http://common-lisp.net/cgi-bin/mailman/listinfo/closer-devel
--
Pascal Costanza, mailto:***@p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium
Pascal Costanza
2009-11-11 14:55:52 UTC
Permalink
Post by Drew Crampsie
Hello,
I'm sure i'm abusing contextl in some way (anonymous layers that
themselves are layered classes), but for my code to work the call to
ADJOIN-LAYER in REMOVE-LAYER-USING-CLASS must pass the layer directly
to ADJOIN-LAYER, not indirect through the layer name.
hunk ./cx-layer.lisp 103
- (layer-name active-layer)
+ active-layer
This works for me and passes all the tests, but i'm not sure if it's
the right thing to do... i'm likely abusing contextl in many ways ;).
Wow, how time passes....

I finally had time to take care of this. I have made several changes in several places in ContextL, and it should now be possible to use named layers by referring to their name, as well as anonymous layers interchangeably. I'm pretty sure that I covered all cases, but of course there could still be problematic corner cases I have missed. Please let me know if this works for you.

Thanks again for submitting this bug report. I'm still interested to know how you use ContextL here... ;)


Best,
Pascal
--
Pascal Costanza, mailto:***@p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium
Loading...