modules, @std, selectively hiding/renaming imports

Claus Reinke claus.reinke at
Fri Nov 25 07:00:50 PST 2011

>> ..
>> The "keys" from "Object" and from "@iter" can't both be in
>> scope, yet both "Object"/"@reflect" and "@iter" seem to be
>> scheduled for inclusion in "@std".
> I think this is a misunderstanding because the "@object" module wasn't
> mentioned at the top of that section of the wiki page, which I've now
> corrected.  The current plan (which is very early, there has been
> little discussion of this) has the `keys' function that produces an
> iterator in "@std" and the `keys' function that is the same as
> `Object.keys()' in the "@object" module.

Yes, on re-reading the current page, I see that I misunderstood 
the organization. You separately enumerate standard prelude
and other standard libraries, but you haven't actually committed
to importing any of them implicitly, nor does the page say which
imports will be available unqualified.

The reason I'm trying to have this discussion at this early stage
is that the whole modules block needs to come under
detailed scrutiny for pragmatic issues as early as possible. It
is a fundamental aspect of, it has passed the proposal
stage with flying colours, and (nearly) everybody is optimistic
about it. Now the pragmatic details need to be checked/refined. 

I tried to list some current module usage patterns in 

    supporting ES upgrading with a programming pattern repo?

It would be good if all of these -and any other module usage
patterns in common use- would be addressed in the modules 
proposal pages. And the (implicit?) standard prelude is entirely 
new for, though there is experience in other languages.

>From previous discussions of the 'for (k of keys(o)){..}' pattern,
I assume that there will be an implicit

    import * from "@std"

Is that correct? If so, my questions are:

1. how do I convert the implicit import into an explicit one?

    taking a leaf from Haskell's (very conventional) module system,
    one could assume that every explicit import of "@std" eliminates
    the implicit import, for instance, but modules will be
    more flexible than Haskell's, so it would be nice to have that
    spelled out.

2. how do I import everything from "@std", with "keys"
    omitted or renamed?

    From Brendan's remarks, no such feature is currently planned?

3. why is "keys" listed under "@std", but not under "@iter"?

    What is the modules story about re-exporting?

On the topic of standard preludes and Haskell experience: I
could search for the links to the relevant features (over time,
users have requested several extensions to get more control
over what is "standard"), if there is interest?


More information about the es-discuss mailing list