How are namespaces implemented in rpython?
Hey all, I'm preparing a presentation for Alfred Aho at Columbia, and I'd like to ask how are namespaces translated during the translation phase. Are they implemented dynamically, or are they actually compiled down to C? Alex
On Mon, Dec 5, 2011 at 11:04 PM, Alexander Golec <thejfasi@gmail.com> wrote:
Hey all,
I'm preparing a presentation for Alfred Aho at Columbia, and I'd like to ask how are namespaces translated during the translation phase. Are they implemented dynamically, or are they actually compiled down to C?
Alex _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
If I understand you correctly, you're asking if the notion of a module (or namespace) exists at runtime for an RPython program, or whether that's resolved at compile time? The answer to that question is that all imports in RPython are resolved at compile time, and thus modules are a purely compile time concept. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero
Impressive. I would think that there would be some trouble with names that may or may not be included in the namespace depending on execution of the module. The module would still need to be executed at runtime, but I'm guessing the names that it might produce are bounded? Alex On Dec 5, 2011, at 11:33 PM, Alex Gaynor wrote:
On Mon, Dec 5, 2011 at 11:04 PM, Alexander Golec <thejfasi@gmail.com> wrote: Hey all,
I'm preparing a presentation for Alfred Aho at Columbia, and I'd like to ask how are namespaces translated during the translation phase. Are they implemented dynamically, or are they actually compiled down to C?
Alex _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
If I understand you correctly, you're asking if the notion of a module (or namespace) exists at runtime for an RPython program, or whether that's resolved at compile time?
The answer to that question is that all imports in RPython are resolved at compile time, and thus modules are a purely compile time concept.
Alex
-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
On Mon, Dec 5, 2011 at 11:36 PM, Alexander Golec <thejfasi@gmail.com> wrote:
Impressive. I would think that there would be some trouble with names that may or may not be included in the namespace depending on execution of the module. The module would still need to be executed at runtime, but I'm guessing the names that it might produce are bounded?
Alex
On Dec 5, 2011, at 11:33 PM, Alex Gaynor wrote:
On Mon, Dec 5, 2011 at 11:04 PM, Alexander Golec <thejfasi@gmail.com>wrote:
Hey all,
I'm preparing a presentation for Alfred Aho at Columbia, and I'd like to ask how are namespaces translated during the translation phase. Are they implemented dynamically, or are they actually compiled down to C?
Alex _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
If I understand you correctly, you're asking if the notion of a module (or namespace) exists at runtime for an RPython program, or whether that's resolved at compile time?
The answer to that question is that all imports in RPython are resolved at compile time, and thus modules are a purely compile time concept.
Alex
-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
During compilation it is statically known what names exist within a module, this is one of the restrictions of RPython. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero
I'm guessing this explains this fragment from the rpython coding guide: constants all module globals are considered constants. Their binding must not be changed at run-time. Moreover, global (i.e. prebuilt) lists and dictionaries are supposed to be immutable: modifying e.g. a global list will give inconsistent results. However, global instances don’t have this restriction, so if you need mutable global state, store it in the attributes of some prebuilt singleton instance. Alex On Dec 5, 2011, at 11:36 PM, Alexander Golec wrote:
Impressive. I would think that there would be some trouble with names that may or may not be included in the namespace depending on execution of the module. The module would still need to be executed at runtime, but I'm guessing the names that it might produce are bounded?
Alex
On Dec 5, 2011, at 11:33 PM, Alex Gaynor wrote:
On Mon, Dec 5, 2011 at 11:04 PM, Alexander Golec <thejfasi@gmail.com> wrote: Hey all,
I'm preparing a presentation for Alfred Aho at Columbia, and I'd like to ask how are namespaces translated during the translation phase. Are they implemented dynamically, or are they actually compiled down to C?
Alex _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
If I understand you correctly, you're asking if the notion of a module (or namespace) exists at runtime for an RPython program, or whether that's resolved at compile time?
The answer to that question is that all imports in RPython are resolved at compile time, and thus modules are a purely compile time concept.
Alex
-- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
On 12/06/2011 05:40 AM, Alexander Golec wrote:
I'm guessing this explains this fragment from the rpython coding guide:
*constants*
all module globals are considered constants. Their binding must not be changed at run-time. Moreover, global (i.e. prebuilt) lists and dictionaries are supposed to be immutable: modifying e.g. a global list will give inconsistent results. However, global instances don’t have this restriction, so if you need mutable global state, store it in the attributes of some prebuilt singleton instance.
Exactly. Cheers, Carl Friedrich
2011/12/5 Alexander Golec <thejfasi@gmail.com>:
Hey all,
I'm preparing a presentation for Alfred Aho at Columbia, and I'd like to ask how are namespaces translated during the translation phase. Are they implemented dynamically, or are they actually compiled down to C?
I assume you mean modules? They're all constant folded out by the flow space. -- Regards, Benjamin
participants (5)
-
Alex Gaynor
-
Alexander Golec
-
Alexander Golec
-
Benjamin Peterson
-
Carl Friedrich Bolz