Type | Wish | Status | pending | Date | 26-Feb-2014 04:50 |
---|---|---|---|---|---|
Version | r3 master | Category | Mezzanine | Submitted by | BrianH |
Platform | All | Severity | minor | Priority | normal |
Summary | Add word to module-local contexts to refer to the local lib |
---|---|
Description |
Just as lib modules export to the lib object, non-lib modules, when requested by another module, export to an object as well. It helps for collecting local imports, managing overrides, same as lib. That object is currently unnamed. For the same reasons that we would want to refer to lib, we would also want to refer to that object. Maybe you want to manually fix up the overrides, maybe you want to get access to stuff that got overridden by your module-local stuff, or by function options, whatever. So, let's add a word to the module's context which refers to this object. Let's call it "local-lib". If we assign the value none to that name if there are no local imports, that would make it easier for modules to detect this if they need to. On the other hand, if we assigned it an empty object by default then it would be just as easy to use EMPTY? to detect that case, and other uses of the word wouldn't need as much conditional code. Local imports to scripts don't work the same way as they do to modules - there is no separate object, the imports go right into the user object. However, if we assign 'local-lib to refer to that context then we'll have it as a shortcut to refer to it, like 'lib is a shortcut for system/contexts/lib. It will have the added benefit of blocking any lib exports of that word from causing problems. |
Example code |
Assigned to | n/a | Fixed in | - | Last Update | 3-Mar-2015 10:38 |
---|
Comments | |
---|---|
(0004277)
BrianH 28-Feb-2014 03:49 |
It's worth noting that the MODULE function's /mixin option takes exactly this object as a parameter. We might want to unify the naming a little. |
(0004278)
abolka 28-Feb-2014 04:15 |
On the naming: I'd slightly prefer private-lib, even though it's a bit longer. I envision it being seldomly used in practice (and typically by very specialised code), which would well warrant the more explicit name. |
(0004362)
acook 9-Mar-2014 04:27 |
Given that we're getting rid of the "private" options when defining modules (#2115) I don't think it makes sense any longer to link those two terms.
I propose "local-lib" which seems to bind more tightly with the problem domain. |
(0004363)
BrianH 9-Mar-2014 04:31 |
Yeah, that's much better. I have to remember to update the terminology and phrasing of all of the module epic tickets, at least that refer to current stuff. |
(0004578)
BrianH 2-Mar-2015 12:55 |
One question: Should there always be a 'local-lib word set, and should it always be set to an object? We have three possibilities:
I'm leaning towards option 1, since it defining it consistently and making it always an object would be consistent with 'lib and easier to explain. |
(0004583)
BrianH 3-Mar-2015 10:17 |
Another issue is how we deal with the issue of silly modules trying to export their local-lib words. However, we don't want to blacklist the word from exports because it will be too difficult to do when you consider #2114, and likely a bad idea even then. For modules it won't be an issue since we can set 'local-lib after all of the other exports are done, but for scripts it's a different issue because they don't actually have the referred-to object as a concept.
I think the best solution for scripts is to just preset the word 'local-lib in the script context to refer to the script context itself. Let it be a shortcut way to refer to system/contexts/user, the way 'lib is a shortcut for system/contexts/lib. Then it won't matter in your scripts what the word has in lib, since imports to the script context don't override existing values unless you do so explicitly. |
(0004584)
BrianH 3-Mar-2015 10:29 |
PR: https://github.com/rebol/rebol/pull/236 |
(0004585)
BrianH 3-Mar-2015 10:38 |
Adjusted the description of the ticket to reflect the above discussion. |
Date | User | Field | Action | Change |
---|---|---|---|---|
3-Mar-2015 10:38 | BrianH | Comment : 0004585 | Added | - |
3-Mar-2015 10:38 | BrianH | Description | Modified | - |
3-Mar-2015 10:29 | BrianH | Status | Modified | submitted => pending |
3-Mar-2015 10:29 | BrianH | Comment : 0004584 | Added | - |
3-Mar-2015 10:17 | BrianH | Comment : 0004583 | Modified | - |
3-Mar-2015 10:17 | BrianH | Comment : 0004583 | Added | - |
3-Mar-2015 09:50 | BrianH | Comment : 0004578 | Modified | - |
2-Mar-2015 12:55 | BrianH | Comment : 0004578 | Added | - |
9-Mar-2014 04:31 | BrianH | Comment : 0004363 | Added | - |
9-Mar-2014 04:29 | BrianH | Summary | Modified | Add word to module-local contexts to refer to the private lib => Add word to module-local contexts to refer to the local lib |
9-Mar-2014 04:27 | acook | Comment : 0004362 | Modified | - |
9-Mar-2014 04:27 | acook | Comment : 0004362 | Added | - |
3-Mar-2014 21:14 | BrianH | Description | Modified | - |
3-Mar-2014 21:14 | BrianH | Summary | Modified | Add word to module-local contexts to refer to the private library => Add word to module-local contexts to refer to the private lib |
28-Feb-2014 04:15 | abolka | Comment : 0004278 | Added | - |
28-Feb-2014 03:49 | BrianH | Comment : 0004277 | Added | - |
26-Feb-2014 05:01 | BrianH | Description | Modified | - |
26-Feb-2014 04:50 | BrianH | Ticket | Added | - |