• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[!REBOL3] General discussion about REBOL 3

Ladislav
20-Jan-2013
[809]
To be understood, my question is whether you prefer

mold/all -0.0

to yield "0.0" or "-0.0"
Andreas
20-Jan-2013
[810]
As `false == same? 0.0 -0.0", I'd prefer mold/all to yield "-0.0".
Ladislav
20-Jan-2013
[811]
OK, counted your vote. I assume that you do not object against

mold -0.0

yielding "-0.0" as well?
Andreas
20-Jan-2013
[812x2]
I have no opinion regarding mold, as I think mold/all should be the 
default.
But yes, if anything, I would prefer MOLD to yield "-0.0" as well.
Ladislav
20-Jan-2013
[814]
(counting as "no objection for the two to behave the same in this 
case")
BrianH
20-Jan-2013
[815]
I would prefer MOLD/all -0.0 to generate "-0.0". As for MOLD, I'm 
on the fence: If the difference between 0.0 and -0.0 is significant 
enough semantically, but not too confusing to the regular programmers 
that MOLD is targeted at, then why not? We definitely don't want 
MOLD and MOLD/all to be the same though, because there are too many 
developers that want to keep the illusion that 0.1 exists. Having 
a display setting to have the interactive console print values with 
MOLD/all instead of MOLD makes sense though.
Andreas
20-Jan-2013
[816x2]
Sorry for starting this, let's not sidetrack this further into a 
discussion of MOLD vs MOLD/all.
(But to clarify a single bit: currently the plan is for MOLD/all 
0.1 to yield "0.1".)
BrianH
20-Jan-2013
[818]
That wouldn't be the whole value.
Andreas
20-Jan-2013
[819]
It is accurate enough, as Ladislav explained before.
Ladislav
20-Jan-2013
[820]
That wouldn't be the whole value.

 - that is actually irrelevant. No software prints "the whole" 0.1000000000000000055511151231257827021181583404541015625, 
 neither I see it as practical
BrianH
20-Jan-2013
[821]
Right, because they print approximate values. If your proposal is 
to change MOLD to generate the smallest value that, while not actually 
being the value in memory, would generate that value in memory as 
a result of the loader trying to approximate what you wrote, then 
I might be OK with that if it can be done efficiently. If it can't 
be done efficiently, I'm OK with doing what all of the other non-scientific 
languages do and just use 15 digits.
Andreas
20-Jan-2013
[822]
That's precisely what Ladislav proposed: "Molding decimal numbers 
'precisely enough'".
Gregg
20-Jan-2013
[823]
R2 says 0.0 and -0.0 are the same, but R3 does not. I replied to 
Lad's googlegroup post that I would prefer "0.0", as evaluating -0.0 
returns 0.0. So, they are equal but not the same under R3. What would 
be a scenario where you would want to maintain the sign?
Andreas
20-Jan-2013
[824]
Evaluating -0.0 yields -0.0. But MOLD is used to format the evaluation 
result, that's what lead you to believe otherwise.
Gregg
20-Jan-2013
[825]
Ahhhh. So, is there every a case where we would want to maintain 
the sign (i.e. because we need the sign itself), or is "-0.0" preferred 
because it is more correct?
GrahamC
20-Jan-2013
[826]
Anyone have a suggestion on how we can get trace/net functionality
Ladislav
20-Jan-2013
[827x7]
R2 says 0.0 and -0.0 are the same

 - actually, in R2 it is possible to devise a test which would discern 
 -0.0 and 0.0, although SAME? can't discern them
, which means I can define my IDENTICAL? function so that

    identical? 0.0 -0.0 would yield FALSE
- if you want to see it, read

http://www.rebol.net/wiki/Identity
That clearly demonstrates that Rebol identity doesn't depend on the 
behaviour of the SAME? function as much as it seems...
It is possible to prove that Rebol identity does not depend on the 
SAME? function at all, in fact, and unsetting 'same? I obtain the 
same identity as when the SAME? function is defined.
(which is what the article demonstrates, in fact)
This actually demonstrates that there may be some level of "arbitrariness" 
in the implementation of the SAME? function, but if the SAME? function 
is arbitrary and differs from the IDENTICAL? function then we are 
able to prove that it is arbitrary and it is not the natural identity 
existing in Rebol regardless of the SAME? function.
GrahamC
20-Jan-2013
[834]
The problem with writing a prot-send.r is that we have no guidance 
yet on where user variables such as name, email and passwords are 
to be stored.
Gregg
20-Jan-2013
[835]
I'll try to read the latest article soon Ladislav, though my scheule 
is packed right now. Thanks for posting it.
Ladislav
20-Jan-2013
[836x2]
That is not "the latest article", it is quite old, to be honest.
You may have just forgotten you already read it
Gregg
20-Jan-2013
[838]
I remember if from before, but I thought you updated it. By "latest", 
though, I meant the most recently referenced here. I still have to 
finish some others I only read half of. :-)
BrianH
20-Jan-2013
[839x3]
Graham, put the settings in a structure that is local to the prot-send.r 
module and managed by it. Non-private module contexts are global.
Either that or don't have global settings at all, have the settings 
passed in a structure to the SEND function. Global settings are overrated.
Nonetheless, the plan was to have a user preferences system, with 
preferences persisted to a user-specific data file named user.r, 
in a declarative dialect (specifically no procedural code allowed 
in user.r). Unfortunately, that last sentence is as far as the plan 
got. We were going to have a community discussion about this, but 
hadn't gotten around to it yet because we're still too early in the 
development. Maybe now's a good time to start that discussiion.
GrahamC
21-Jan-2013
[842x2]
non private global context ?
non private module contexts are global ?
so how to define?
BrianH
21-Jan-2013
[844x5]
I apologize if this kind of thing seems complicated, but a lot of 
the module system happened as side effects of the original design. 
Carl's original module proposal was high-level and not actually implemented, 
so there were some implications that he didn't really know about 
at first. Once we worked through the details, we ended up with a 
more flexible module system than he originally specified (that was 
the first rewrite). Then we changed the interface and usage to make 
it simpler and make the code more maintainable (rewrite two), then 
refined it based on the new model and added many new ways to make 
it even simpler to use, and some new features Carl and others wanted 
(rewrite 3). So I hope that you'll bear with me for a moment.
Regular

 modules have names and versions so they can be loaded only once, 
 and upgraded in place if need be. As a side effect, this makes the 
 module's context effectively global. We have a few built-in global 
 contexts, but we don't necessarily have to make built-in global contexts 
 for stuff that is managed by modules because the module contexts 
 are themselves global.
The exports of regular modules are collected in the lib context (the 
"runtime library") when they are initially imported. All potential 
conflicts between exports of different modules, any overrides that 
need to be done when you upgrade a module or use another module to 
make changes, these are all managed in lib. All modules import stuff 
from lib. You can tell if a module is loaded by checking for it by 
name, and for that matter even the module system itself can only 
tell if a module is imported by checking for it by name.
Private

 modules were a side effect of the module name being optional. If 
 a module doesn't have a name, you can't check for whether it is already 
 loaded, so you have to load it again every time it is requested. 
 The module itself can't even tell if it was loaded before, so it 
 can't know whether it needs to resolve conflicts between itself and 
 other instances of itself. That makes it basically unsafe to have 
 an unnamed module export to lib. So instead, we skip the lib middleman 
 and import those exports directly into the target module or user 
 context, which makes the unnamed module effectively owned by that 
 target, a "private" module.


We found this facility useful enough that we added an explicit option 
to make it private (options: [private]). That makes it possible to 
have a named private module, which has some interesting abilities 
just from having a name. Having a name means that you can have the 
module load only once, and being private means that if you want to 
use its exports you have to import the module explicitly, so combined 
it means an explicitly accessed module that can share resources with 
other targets that also explicitly import the same module.
Overall, "private" modules are really useful if you are writing traditional 
modular systems that require explicit importing to manage complexity. 
This should be familiar to people who have worked with Maxim's slim 
modules, or Gabriele's module system for R2.


The "regular" modules are more useful for writing library code that 
is intended to be used by people writing scripts, as if R3 were not 
a modular system. This should make things easier for people coming 
from R2 or some other non-modular or weak-modular language. Underneath, 
a "script" is another kind of module; it's just the type of module 
that does the best job of pretending that it isn't a module.
Maxim
21-Jan-2013
[849x5]
one big difference is that slim doesn't bind to a global library 
area.   each module is completely shielded and imports "on its own". 
 

its a hierarchical system without namespaces.
but I'll probably be using modules as the basic construct for slim 
R3, instead of objects... in my model, it might not really matter, 
I manage access/biding to/from modules actually altering and expanding 
the module when it is being loaded.


the data being sent to slim isn't executed directly, the block is 
sent to a manager, which does some binding and security stuff first.
it also adds some extra capabilities to all modules, stuff like vprint/vlogging.
anyhow... Brian and I will eventually get to actually implementing 
the R3 module /  slim model sometime this year.  I don't want to 
start a philosophical debate here.  :-)
I mean, I will implement, based on discussions and tests I'll have 
with Brian, to understand the intricasies of why/how modules are 
as they are now.
Gregg
21-Jan-2013
[854x2]
Brian, is there a doc that has your above comments in it? http://www.rebol.net/wiki/Module_Design_Details
looks like it covers a lot of ground, but I don't know if you wrote 
it, and whether it has some of the design notes included. I think 
they're very useful and informative.
And it should have links to Slim and other alternatives.
BrianH
21-Jan-2013
[856]
Gregg, I wrote that doc (and forgot the link, thanks), but it needs 
updating. It is about one or two rewrites behind.
Gregg
21-Jan-2013
[857]
Hard to keep up, and keep track, with everything. :-)
BrianH
21-Jan-2013
[858]
Maxim, slim modules are like R3's named private isolated modules. 
And the equivalent of the "global library area" in R2 is system/words, 
so if you have any code that binds to or imports from system/words 
then you have the equivalent of lib.