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

World: r3wp

[Core] Discuss core issues

BrianH
14-May-2011
[1480]
Keep in mind that the main intended purpose of MOLD is to generate 
REBOL source code. You are suggesting that it generate more complex, 
larger source code.
GrahamC
14-May-2011
[1481x3]
Yes, I'm suggesting that a system wide flag should control the display
I just can't imagine any scenario when the above example is useful
ie. 1E-2
BrianH
14-May-2011
[1484]
Settable system-wide flags that affect MOLD are a bad idea, since 
they mean that you have to put wrapper code around every call to 
MOLD to make sure that it matches what your code expects. This makes 
very call to MOLD more complex and less task-safe.
GrahamC
14-May-2011
[1485]
R2 has no tasks
BrianH
14-May-2011
[1486x5]
Recursion-safe then, or async-safe, whatever. Yes, this includes 
system/options/decimal-digits.
That is why there is a proposal for R3 to make all such options be 
specified at the point of call, not globally. Any global option like 
that would be protected from modification, or else it wouldn't be 
allowed.
This would mean that you would replace this code:
    saved: system/options/binary-base
    system/options/binary-base: 64  ; or 16, whatever
    output: mold data
    system/options/binary-base: saved
with this:
    output: mold/with data [binary-base: 64]


This saves code since you can't trust that any global option will 
remain even its default value without data flow analysis unless it's 
protected.
In any case, you were still leaving parts out of your date formatting. 
If you left it all in it would look like this:
>> 15-may-2011/12:00:00.00
>> 15-May-2011/12:00:00.000000+00:00
Sorry, I forgot 3 zeroes: 15-May-2011/12:00:00.000000000+00:00
GrahamC
14-May-2011
[1491x3]
I'd prefer that
I can always reduce the numbers for display
It's much more work to increase the numbers
BrianH
14-May-2011
[1494x3]
Not for source code output you wouldn't, especially since those extra 
zeroes don't add any information. It's no work at all to increase 
the numbers, since all of those zeroes are there in the original 
date value. So if need less flexible formatters, they're easy to 
write.
What you want isn't MOLD, it's a different formatting function. MOLD 
is for REBOL source, not for S3.
If you do MOLD output and then reduce the number of zeroes output, 
it requires parsing MOLD's output. Working straight from date! values 
means no parsing required.
onetom
14-May-2011
[1497]
this who "binary" talk is quite fucked, btw. as if carl never worked 
w low-level stuff... but after seeing a whole nation (singaporeans) 
calling the desktop machine CPU, im not surprised... just disappointed..
wtf does binary-base mean? binary already means number-base 2...
Gregg
15-May-2011
[1498x2]
if it's a date with no time portion, then date/date gives you an 
error.


It works for me. Or maybe I'm doing it differently. A date! always 
has a time value, correct, though it may be none? And if it's none, 
that affects the default formatting.


While I've had a few times that the trimming of zeros from time values 
annoyed me, it isn't high on my priority list. If I don't like REBOL's 
default format, or if I have to send data to another process, I just 
know I need to format it.
The default format will never be right for all uses.
Maxim
15-May-2011
[1500]
and now that we have now/utc, a lot of the pain is gone, IMHO.
GrahamC
15-May-2011
[1501x4]
Gregg ... now it doesn't give me an error!
either Rebol is non-deterministic, or, I'm having a bad day
The issue is that web apis using different languages don't use datatypes 
in the same way.
I'd be okay if I only used Rebol web apis!
Geomol
15-May-2011
[1505x2]
Having QUOTE, would it be an idea to have CITE like this?

cite: func ['word] [:word]


Only difference, I think, is when passing any-function! types to 
it:

>> type? quote next
== action!
>> type? cite next 
== word!

All other types seem to return the same for QUOTE and CITE.
Passing an unset word to QUOTE will return unset! in R2, and will 
return the word in R3. CITE returns the word.
Andreas
15-May-2011
[1507]
Graham, have a look at http://www.rebol.org/view-script.r?script=form-date.r
BrianH
15-May-2011
[1508x2]
Geomol, in R2 when you pass a word to a get-word parameter, the value 
assigned to that word is passed instead. There may have been a good 
reason for this initially, but in the long run it turned out to be 
a bad design choice, and was fixed in R3. It has nothing to do with 
the any-function! types.
There is a similar special case for when you pass a get-word value 
to a lit-word parameter, bot in R2 and R3. R2's APPLY function has 
code to undo these special cases, and R3's APPLY doesn't do the special 
evaluation; APPLY is used to break the evaluation rules, often for 
safety.
GrahamC
15-May-2011
[1510]
Didn't know about Chris' date formatting
BrianH
15-May-2011
[1511]
Great work on that date formatting! I prefer compiled dialects over 
interpreted ones for volume work, but it's definitely the right idea 
:)
Geomol
17-May-2011
[1512]
Tonight's Moment of REBOL Zen:


How should R2 functions be categorized? They're not really functions 
with vars only temporarely on a stack:

>> c: func [a b] [[a + b]]
>> do c 1 2
== 3

but also not really closures with individual contexts:

>> f: func [a] ['a]       
>> word1: f 1
== a
>> word2: f 2
== a
>> get word1
== 2
onetom
24-May-2011
[1513]
aaaw... ask/hide doesn't work if i start rebol with the -w option, 
which i might accept, IF there would be a way to start it without 
a clear screen... it doesn't integrate nicely with unix this way...
Geomol
24-May-2011
[1514x2]
Yes, we had a discussion about this in the Core group recently. See 
posts around 13-May.
Sorry, my last post here was an answer to something in the !REBOL3 
group.
Geomol
26-May-2011
[1516]
FIRST, SECOND and THIRD can be used on functions like:

>> first :repend
== [series value /only]


SECOND and THIRD returns the function body and spec. FIRST returns 
a stripped spec, just the arguments and refinements. I notice, it's 
produced each time contrary to the other two:

>> same? second :repend second :repend
== true
>> same? third :repend third :repend  
== true
>> same? first :repend first :repend
== false


What is FIRST on a function used for? It may be used internally, 
but does anybody use it externally? It seems more logical, if FIRST 
on a function returned the spec, SECOND the body, and nothing else.
Ladislav
26-May-2011
[1517]
This is not a useful subject to discuss, due to the changes in R3
Geomol
26-May-2011
[1518]
I see, they're all produced each time in R3:

>> same? reflect :repend 'spec reflect :repend 'spec
== false

Guess the R3 implementation is better in this case.
Gabriele
26-May-2011
[1519]
Geomol, that's very useful if you want to count the number of arguments 
of a function etc. - think of it as a pre-parsed function spec.
Geomol
26-May-2011
[1520]
Yes, I see the benefit. I was just wondering, if it was actually 
used. I guess, you used it somewhere? :)

If used, would it be more logical to have FIRST return the spec, 
and THIRD return, what FIRST return today? Or am I missing some vital 
point?
onetom
26-May-2011
[1521]
its a remove-each e spec-of fn [find type? e [string! block!]]
Geomol
26-May-2011
[1522]
Looking at SPEC-OF, and another question pop up. Why isn't copy/deep 
the default for COPY? Wouldn't the world be much easier, if it was?
Micha
26-May-2011
[1523x3]
I need some help
My server has multiple ip.
it is possible to select the ip address ?
I want to download the page, and to do it from different ip
p: open tcp://

i: get-modes p  'interfaces
 probe i

 probe i
[make object! [
        name: "if16"
        addr: 91.121.*.*
        netmask: 255.255.255.0
        broadcast: 91.121.*.*
        dest-addr: none
        flags: [broadcast multicast]
    ] make object! [
        name: "lo0"
        addr: 127.0.0.1
        netmask: 255.0.0.0
        broadcast: none
        dest-addr: none
        flags: [multicast loopback]
    ] make object! [
        name: "if16"
        addr: 188.165.*.*
        netmask: 255.255.255.255
        broadcast: 188.165.*.*
        dest-addr: none
        flags: [broadcast multicast]
    ]]
onetom
26-May-2011
[1526]
wow, i didn't know u can do that! where is it documented? i just 
remeber get-modes in relation to setting binary mode for the console 
or parity and speed setting for the serial port...
Micha
26-May-2011
[1527]
you can not just choose adress  ip .   I ask if there was any way 
.
Dockimbel
26-May-2011
[1528]
AFAIK, there is no way to do that using REBOL ports.
Micha
26-May-2011
[1529]
thanks