On Wed, 2009-09-16 at 20:19 -0500, Brian Mastenbrook wrote: > On Sep 16, 2009, at 7:55 PM, Derick Eddington wrote: > > > Further, inexpert users regularly accidentally include > > unnecessary levels because they don't understand what levels are > > necessary, and for systems which always instantiate/visit libraries > > for > > every given level, this could cause additional phase problems which > > would not happen in an implicit phasing system. > > What problems would creating an unnecessary instantiation of a library > cause? It will be created and then destroyed.
It all depends on what a library's instantiation does. Since library instantiation can perform arbitrary computations, e.g. side effects, it can potentially cause problems if the computations happen when they weren't supposed to. I believe that using libraries for lower-level "systems programming" tasks, which "pure-Scheme (mostly)" implementations do and other Scheme purists want to do, is where these problems come up more (but I'm not an expert about this). > Hopefully, nothing bad > comes of just instantiating a library. Otherwise, you're probably > doing something goofy in the first place. I'll leave it to the experts to further comment about this particular issue if they want. (They're already aware of each others' positions and at a stand-still.) The first point I made in response to Andre about "other problems with implicit phasing" is what I really wanted to focus on. > > I'm willing to continue using "explicit phasing" to keep my > > code > > portable and to gain more experience with it. So far (2 > > years), > > I've become more convinced I like "implicit phasing" better. I > > think a better compromise would be that imports without level > > declarations are always "implicit phasing" and imports with > > level declarations are always verified (which I suppose would > > always require declarations for level 0 to verify that only > > level 0 is used, and I see that as more consistent with the > > purpose of "explicit phasing"), instead of the current > > compromise where "implicit phasing" style is not portable and > > "explicit phasing" style is ignored by some systems and so not > > portable according to the authors' intent -- this way both > > sides can do it their way *and* be portable. > > > Having imports without level declarations "implicitly" phased is not > generally possible for separate-instantiation systems (which need to > instantiate the library *before* deciding that the binding access > should be allowable). I'm not sure what you mean by "separate-instantiation". Do you mean, what I've seen termed, "multiple instantiation", i.e. each library is re-instantiated for every library it's imported in and for every phase of a library it's used for, or do you mean separate instantiation which happens when separately compiling libraries. Ikarus fully supports separate compilation and is fully implicitly phased. "Multiple instantiation" can still fully be done with implicit phasing, because the same inferring of phases can be used to know what and when to re-instantiate. > You could instead say that no level declaration > means phases (-1, 0, 1). This would probably have the same effect for > most users. That would be inconsistent for levels other than those. The phasing issues are already confusing, and I think inconsistencies make it more so. R6RS's export levels already make it possible to import at levels '(-1 0 1), or whatever you want, without import level declarations, if you make a re-exporting wrapper library, and I think this is philosophically/mentally inconsistent with explicit import level declarations and so I don't like it. > I imagine that very few users ever need to import libraries at level > 1, Every define-syntax (let-syntax, etc.) at level 0 requires its RHS expression's bindings to be imported at level 1. But maybe you meant: very few users ever need to explicitly declare (for --- (meta 1))? If that's what you meant, I think you're wrong, because procedural-macro helper procedures can be, and in my code often are, imported, and so, for explicit phasing systems, they need the explicit import level declaration (because I don't use re-exporting wrapper libraries to get export levels other than 0). I think this re-usable modularity of macro helpers should be encouraged. > assuming that the rnrs meta library is the most common way of > getting at `syntax-case' & friends. I would imagine that even fewer > ever need to touch a level greater than 1, or lower than 0. I think that's misguided. We all like abstraction, right? When making a complex macro, which I know not a few people do because macros can do awesome things, you might want syntactic abstractions for your implementation of the complex macro -- these run at phase 2 -- just as you might want syntactic abstractions for level 0 code. When making macro helper procedures, which are in a library for modular re-usability, you might want to have syntax templates which have syntax templates in them, which is certainly appropriate for some macro-defining-macro abstractions -- these have their references at level -2. > My general > preference is to use `syntax-rules' whenever possible, and to dip into > `syntax-case' when it's absolutely necessary for the task at hand. Me too. But I'm very interested in flexing these awesome macros for tasks which require, or are more clearly or efficiently implemented using, procedural macros. I have many procedural macros. Portable, lexically-scoped procedural macros, at whatever phase I want, are one of my primary attractions to R6RS and primary criteria for continuing my interest in Scheme. > As > such, I very rarely need to touch phases at all. [No offense] I guess your macros aren't complex enough to require it. > Others seem to use > `syntax-case' even when it's not necessary at all, but rarely do I see > metasyntax. (If *anyone* has written a library import for phase >= 2 > I'd like to see it. I can vaguely understand why one might need to use > a phase <= -1, but I'd like to see a good example for that one too.) I have multiple real examples of explicitly declaring levels -1 and 1, but none currently for lesser or greater levels. I've explicitly declared level 2 a few times when making real initial-prototype code, but those few prototypes changed for other reasons as they evolved. I certainly don't want the possibility of using less-common levels to be unnecessarily marginalized. -- : Derick ---------------------------------------------------------------- _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
