r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Pekr
11-Jan-2010
[20678x2]
But - was switch always native?
It is difficult for me to explain, but - I thought, that 'switch 
case block could be treaded some other way internally. Not reduced, 
but in kind of  "DELECT" or dialect kind of type. Then you could 
really write any datatype for the case ..... not sure it is doable 
nor neccessary, just thinking aloud ...
Rebolek
11-Jan-2010
[20680x2]
What you want is that words that get evaluated to datatype! should 
be evaluated but other words shouldn't. That's inconsistent and for 
everyone trying REBOL is better to understand the difference between 
word! and it's value than otherwise.
I agree that it may look confusing to some people, same as:

>> f: func [a][append [] a]       

>> f 1
== [1]


>> f 2

== [1 2]


But as I said, it's better to understand why works this way than 
dumbening the language just because newbies may be confused.
Pekr
11-Jan-2010
[20682]
no, you don't understand. It is just you understanding the only one 
holy way - submitting function a regular REBOL code :-) Whereas I 
was just wondering, with rather uniform design of switch (case followed 
by code to execute), if we could supply kind of dialect to switch 
function as a body. The same way as how we have 'secure, 'get-modes 
or other dialects ...
Rebolek
11-Jan-2010
[20683]
...why IT works...
Pekr
11-Jan-2010
[20684]
Then there would not be need for type?/word ...
Rebolek
11-Jan-2010
[20685x2]
Ah, ok, some kind of dialect - I'm not against it, if you design 
something and put it here I thing it will get some attention, it 
will be enhanced and it also  may become part of Rx. But SWITCH uses 
"the only holy way" and that's good :)
Also I think that adding those five characters "/word" to your (or 
Graham's who asked initialy) code takesmuch less time than this discussion.
Pekr
11-Jan-2010
[20687]
fixing docs as well ...
Rebolek
11-Jan-2010
[20688]
As Orbital said, "sad but true". Fixing docs is probably !1.
sqlab
11-Jan-2010
[20689]
switch works with datatype!, if you use a datatype! (read a true 
datatype!)  in the block.
see 
switch type? %test.r [#[datatype! file!]    [print "type file!"]]
Pekr
11-Jan-2010
[20690]
ah, interesting ....
BrianH
11-Jan-2010
[20691]
Pekr, "The cases can be any datatype" refers to the type of the values, 
not their value. The type of integer! is datatype!, the value is 
#[datatype! integer!]. You can use the serialized syntax if you want 
to specify dataype! values directly, but watch out: If your build 
process goes through a MOLD then the serialized syntax will be lost 
- this tripped me up when I was porting R2/Forward to the R2 mezzanine 
code, I had to rewrite TYPES-OF and TO-TYPESET.
sqlab
11-Jan-2010
[20692]
Do you use it during mold?
I think you loose it thru load.
BrianH
11-Jan-2010
[20693]
There was a suggestion that SWITCH treat certain words as keywords, 
translating them to their standard values, in particular logic! and 
datatype! keywords. This would make SWITCH work like CONSTRUCT, and 
would likely require an /only refinement for the non-keyworded behavior 
like CONSTRUCT has. This would add a little overhead to SWITCH, but 
not as much as the workaround code already adds. The question hasn't 
yet been resolved, and should be brought up again for final resolution 
- some mezzanine code would need revising.
sqlab
11-Jan-2010
[20694]
I just checked it.
loading after a mold/all still gives the datatype!
Pekr
11-Jan-2010
[20695]
BrianH: what does it mean, that serialised syntax will be lost? I 
thought that we are closer to the state, when REBOL is going to be 
fully serialisable :-)
BrianH
11-Jan-2010
[20696x4]
Yes, but MOLD/all loses the procedural syntax that MOLD generates, 
so many types just don't work when loaded because of binding.
Pekr, the opposite of LOAD is MOLD/all, the opposite of DO is MOLD. 
MOLD doesn't generate serialized syntax.
R3 won't be fully serializable, even when the bugs are fixed. You 
won't be able to serialize handle!, command!, task! or module! values.
Or native!, op! or action! values.
sqlab
11-Jan-2010
[20700x2]
I think load should be the match for mold, and load/all for mold7all
mold/all
BrianH
11-Jan-2010
[20702x4]
No, LOAD doesn't execute code, and the point of MOLD is to generate 
executable code. LOAD/all does something different.
The basic function to load REBOL code is DO. Most types are constructed, 
not literal. Even the scoping is procedural.
Gabriele, PIPE should definitely be included in R3, even if it's 
mezzanine. It would be worth it just to keep people from overloading 
READ with too much high-level crap. It would be mezzanine first in 
any case - we only convert functions to native once their behavior 
is agreed upon and we can say for sure that performance is worth 
it.
Is it alright with you if we try to adapt PIPE? Has it been posted 
publicly? I remember seeing it but can't remember if it was private.
Graham
11-Jan-2010
[20706x2]
An old time reboler like me still gets confused hence the question 
...
It would help if someone updated the docs ... or gave us write access 
to the help/doc wiki
BrianH
11-Jan-2010
[20708x2]
Are you on R3 chat? That is the first step in getting write access 
to the R3 manual wiki.
The manual uses the same login.
Graham
11-Jan-2010
[20710x2]
I was on last night
before I crashed it with an invalid dataype error
BrianH
11-Jan-2010
[20712]
Which platform?
Pekr
11-Jan-2010
[20713]
Graham - if you have sufficient R3 Chat ranking (IIRC 40), you can 
log-in and edit R3 Docs ... authentication database is shared ...
BrianH
11-Jan-2010
[20714]
And have you tried logging into the manual with your chat ID?
Graham
11-Jan-2010
[20715]
updated 'write documentation to remove the /binary
BrianH
11-Jan-2010
[20716]
Cool. Does the READ doc have the same /binary option?
Graham
11-Jan-2010
[20717]
The other refinements look wrong as well.
BrianH
11-Jan-2010
[20718x2]
Actually, can you update it to remove all optioins not supported 
by R3? READ and WRITE are low-level functions in R3.
Don't add proposed options either - we can add them when they become 
actual. The rebol.net wiki is the place to put proposals.
Fork
11-Jan-2010
[20720]
Regarding some of the above discussions of type?/word, I feel the 
confusing bit is that integer! the datatype and integer! the word 
probe identically.  If the word was integer! and the datatype were 
integer!! (for instance) then it would prohibit you from writing 
(to-word type? foo) but at least you could tell what was going wrong 
in your switch, because it would tell you that integer!! wasn't defined 
as an actual word.  You could still write (integer! = type? foo) 
in expressions.
Graham
11-Jan-2010
[20721x2]
BrianH - crashed on windows 7
Steeve talked about using a dialect to write schemes .. to create 
the FSM needed ... weren't you also doing something along these lines 
as well?
BrianH
11-Jan-2010
[20723]
Oh wait, that happened to me too. The http scheme doesn't handle 
server errors well, and the internet has been getting increasingly 
crappy lately. That's why I've been looking over the scheme lately.
Graham
11-Jan-2010
[20724]
and what have you discovered?
Fork
11-Jan-2010
[20725]
^-- Actually, it need not keep you from writing (to-word type? foo) 
if it knew that datatypes should have the last ! chopped if turned 
into a word
BrianH
11-Jan-2010
[20726]
Not much yet - I'm still reviewing the lower levels. There are two 
levels below the http scheme: TCP and the port model.
Graham
11-Jan-2010
[20727]
Where's UDP?