Hey all, On 2017-06-05 11:43, Peter Bex wrote: > On Mon, Jun 05, 2017 at 06:09:54PM +1200, Evan Hanson wrote: > > Is that right? Personally, I'd rather make (declare (hide ...)) simply > > do the right thing -- the right thing being the behaviour you originally > > expected when filing #1376 -- than add a new type of declaration or > > module syntax. > > > > I think this is similar to what Peter has said on that ticket, so a > > patch of that sort would be very welcome. > > This is slightly more complicated due to declare being module-unaware. > > (declare (hide foo)) > > (module a * (import chicken scheme) (define foo 1)) > (module b * (import chicken scheme) (define foo 2)) > > Which foo should be hidden? Both, or none?
Personally, I'd expect the following behaviour, depending on where the declaration appears: [1] (module a * (import chicken scheme) [2] (define foo 1) [3]) [4] (module b * (import chicken scheme) [5] (define foo 2) [6]) [7] (import a) [8] (import b) [9] [1]: foo (a noop as things work currently, or an error as you propose) [2]: a#foo [3]: a#foo [4]: foo [5]: b#foo [6]: b#foo [7]: foo [8]: a#foo [9]: b#foo I suspect this is also the current behaviour, but I'd need to check to confirm. > I think the sane thing to do here is to make it error out, > considering there's no top-level foo to hide I think the issue of whether or not to make declarations error out when one of the hidden identifiers doesn't exist is a separate one from whether it should affect module exports. I slightly prefer the current, more forgiving behaviour, but don't feel too strongly about it. If we do make a change, however, I think it should affect all declarations that take identifier names (where it makes sense), not just `hide'. > make it work like this: > > (module a * > (import chicken scheme) > (define foo 1)) > (module b * > (declare (hide foo)) > (import chicken scheme) (define foo 2)) > > So here a#foo is visible and exported, while b#foo is hidden and > not exported. +1, I agree. Another question is whether this behaviour should apply in eval'd code as well. I think no, declarations should still be fully ignored in eval. Cheers, Evan
signature.asc
Description: PGP signature
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers