You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Like for many other target types, MAKE accepts a numerical second argument for MODULE! to make a module with an empty body. However, the resulting spec is NONE, which makes the module quasi unusable (import requires that spec/name is set).
>>m: make module!10>> body-of m
== []
>> spec-of m
== none
Actually, the resulting module is useless because it doesn't do anything. Unnamed modules are treated as mixins, so not having a name doesn't make a module inherently useless.
Rebolbot commented on Mar 29, 2010:
Submitted by:meijeru
I accept that a spec of NONE does not need to be useless. But -- as you rightly point out -- an empty module body is truly useless. It would not be so if one could append to a module after it has first been defined. But I seem to recall that you took a dim view of that (comments to #896).
In short: why allow an integer second argument to MAKE MODULE! ?
Rebolbot commented on Apr 27, 2010:
Submitted by:Carl
Let's hear both sides: why allow modules to extend? What use is it? And... Why not allow extend? What's the harm?
Rebolbot commented on Apr 27, 2010:
Submitted by:BrianH
Why not:
It messes with the ability for module code to find out about their module through reflection on 'self. If the module can be extended from the outside, you won't be able to rely on self being the context in which your code was bound; it could be a little different. This can include code injection tricks (that Meijeru has demonstrated) if you are writing R2-style code; R3-style should be fine.
What use is it:
It's a place to put your stuff, instead of in an object inside the module. Doesn't seem like a good practice though.
@meijeru I believe that every module should have some spec, so I consider it a bug.. the same like make module! #(a: 1) where now module is created without spec. I don't see a reason why it should be possible to create a module from map!, when it's already not allowed from object!.
Submitted by: meijeru
Like for many other target types, MAKE accepts a numerical second argument for MODULE! to make a module with an empty body. However, the resulting spec is NONE, which makes the module quasi unusable (import requires that spec/name is set).
Imported from: CureCode [ Version: alpha 97 Type: Issue Platform: All Category: Datatype Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#1551
Comments:
Submitted by: BrianH
Actually, the resulting module is useless because it doesn't do anything. Unnamed modules are treated as mixins, so not having a name doesn't make a module inherently useless.
Submitted by: meijeru
I accept that a spec of NONE does not need to be useless. But -- as you rightly point out -- an empty module body is truly useless. It would not be so if one could append to a module after it has first been defined. But I seem to recall that you took a dim view of that (comments to #896).
In short: why allow an integer second argument to MAKE MODULE! ?
Submitted by: Carl
Let's hear both sides: why allow modules to extend? What use is it? And... Why not allow extend? What's the harm?
Submitted by: BrianH
Why not:
What use is it:
Why allow it:
The text was updated successfully, but these errors were encountered: