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

World: r4wp

[!REBOL3] General discussion about REBOL 3

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
[858x5]
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.
Btw, module systems like slim are the reason why I changed the underspecified 
parts of Carl's original module system into features that you might 
find familiar. It wasn't based on slim specifically, or even Gabriele's 
system, but an earlier module system that I wrote for the Apache 
module version of R2 back in 1999. It had similar characteristics 
to your module systems because I had come from strong modular languages 
like Oberon and Delphi, and because I had to solve some of the same 
problems you did.
Most of the characteristics of R3's module system are the result 
of combining the system model of R3, the binding model of Rebol, 
and Carl's goal of simplifying things for developers not familiar 
to modular programming. Every bit of syntax that Carl wanted to be 
optional or minimal in order to make things easier for end-developers 
had semantic consequences. The runtime library lib, for instance, 
is the result of having to manage a modular multithreading system 
that can be used by scripts that can be written as if R3 were single-tasking 
and monolithic like R2. Doing that requires that modules have certain 
characteristics (such as a name).
Adding the slim management tools won't change the semantic model 
of R3's modules much, because that semantic model is the result of 
the system model. However, applications designed to be managed by 
slim would likely use a different module type by default than applications 
that are designed around R3's model. Same for porting stuff written 
for Gabriele's module system, you'd be using the same module type 
(named private isolated). That's OK, R3's module system supports 
those models already :)
If R3's system model changes, that *would* affect the semantic model 
of modules. Right now the task! model is a bit underspecified and 
extremely underimplemented, and the module system is built around 
Carl's proposed tasking behavior. If that changes, as it might since 
Carl's proposal isn't fully implemented yet and is incomplete even 
in spec, then we might have to tweak the semantic model of modules 
accordingly.
Ladislav
21-Jan-2013
[863x2]
News for people interested in decimal molding:

>> system/version
== 2.101.0.3.1

>> mold 0.1
== "0.1"

>> mold 0.3
== "0.3"

>> mold 0.30000000000000004
== "0.3"

>> mold/all 0.30000000000000004
== "0.30000000000000004"

>> mold/all 0.3
== "0.3"

>> mold/all 0.1
== "0.1"

>> mold/all 0.10000000000000001
== "0.1"

>> mold/all 0.10000000000000002
== "0.10000000000000002"

>> system/version
== 2.101.0.3.1

>> mold/all 0.10000000000000001
== "0.1"

>> mold/all 0.10000000000000002
== "0.10000000000000002"

>> mold/all 0.3
== "0.3"

>> mold/all 0.30000000000000004
== "0.30000000000000004"
And, BTW, Andreas, regarding the 15 vs 17 digits: I think that we 
can give in easily in this case, just put 

system/options/decimal-digits: 17


to your rebol.r and MOLD decimal will behave exactly like MOLD/ALL 
decimal.
GrahamC
21-Jan-2013
[865]
In R2 I have this

>> any-string? read/binary %test-module.r
== true

In R3
>> any-string? read %test-module.r
== false
Andreas
21-Jan-2013
[866]
Yes, Graham, in R3 a binary! is not an any-string!:
>> any-string!
== make typeset! [string! file! email! url! tag!]
GrahamC
21-Jan-2013
[867x2]
Why?
the change?
Andreas
21-Jan-2013
[869x2]
I'd assume because only Unicode datatypes are considered any-string! 
now.
Ladislav: looks great!
Gregg
21-Jan-2013
[871]
Thanks for posting that Ladislav! Keep up the good work.
GrahamC
21-Jan-2013
[872x2]
https://github.com/gchiu/Rebol3/blob/master/protocols/prot-send.r
and with the latest prot-smtp.r can now send attachments .. I tried 
a 60Mb one and it went fine.


same syntax as in R2

send/attach [carl-:-rebol-:-com] "Carl, need to remove the spam from blog 
comments" %attachment.exe
Lost text = I send a 60Mb avi as an attachment which went through
Oldes
23-Jan-2013
[874x2]
Graham, I'm really not sure it's good idea to show these commands 
on web-public forum. Why don't you use your email in such a cases?
Regarding binary not a string - string is unicode which may differ 
per platforms.
GrahamC
23-Jan-2013
[876]
Oldes, I believe emails are scrubbed by the script that uploads these 
feeds to the rebol.org site
Bo
23-Jan-2013
[877]
And [carl-:-rebol-:-com] is not Carl's email address any longer. :-)
Arnold
23-Jan-2013
[878]
? He owns the domain rebol.com doesn't he? So he gets all emailaddresses 
with that domain. Unless he assigns someone else one of those emailaddresses 
it is his. So he might not be using it anymore or somebody else is 
using it now?
Bo
23-Jan-2013
[879]
All emails to [carl-:-rebol-:-com] get redirected to null. :-)
Arnold
23-Jan-2013
[880]
Sometimes those seem like the same thing yes indeed :-)
GrahamC
23-Jan-2013
[881]
I know what Carl uses as his email and yes, I knew it wasn't what 
I wrote above.  Last time I looked he had an s at the end of this 
name.
Arnold
23-Jan-2013
[882]
correct
Gregg
23-Jan-2013
[883]
Now he'll have to change it again, as this is web public. ;-)