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

World: r3wp

[Core] Discuss core issues

Ladislav
9-Oct-2011
[2394x2]
In general, I do not expect the #"%" character to be contained in 
the texts being followed by a digit. At least not frequently enough 
to normally matter.
But, sure, in strings that are not meant to communicate something 
to humans, the frequency of "%" may be higher.
Ladislav
10-Oct-2011
[2396x3]
Hi, I found the following text part in the Replacement article: "ENLINE 
any-block!,". Forgive my ignorance, please. What exactly is ENLINE 
meant to do in case its SERIES argument is a block?
I am especially curious, if it really qualifies as non-modifying 
function in that case.
aha, nevermind, I just used some tests to find out what it does
BrianH
10-Oct-2011
[2399]
I really wish the ENLINE/with ticket would be implemented. I could 
use this function daily.
Ladislav
12-Oct-2011
[2400x2]
In R3 we have got the

    system/state/last-error


, which is great for convenience. Is there a corresponding variable 
in R2?
If it does not, it would be great to have this feature backported...
Geomol
12-Oct-2011
[2402]
Today's Moment of REBOL Zen:

>> s: "A"
== "A"
>> lowercase s
== "a"
>> s
== "a"
>> c: #"A"
== #"A"
>> lowercase c
== #"a"
>> c
== #"A"
Ladislav
12-Oct-2011
[2403x2]
:-)
I hope you know why?
Geomol
12-Oct-2011
[2405]
Yes, I do.

And I'm thinking, if it would be an idea to let functions like that 
take word arguments handling them like call-by-reference. Then it 
would be possible to change chars too.
Endo
12-Oct-2011
[2406]
You mean also
>> i: 5
== 5
>> multiply i 4
== 20
>> i
== 20 (?)
Geomol
12-Oct-2011
[2407x2]
That would be
	multiply 'i 4

then. Maybe not too useful in that case. Or though, the ++ operation 
(function) could use this too. Which then reminds me, that NEXT should 
be used for what ++ does. :)
There was a discusson in Carl's blog about this long time ago.
Endo
12-Oct-2011
[2409x2]
move-next 'series
 looks ok but multiply looks weird.
but ++ already works for series as you say.
++ : "Increment an integer or series index."
Geomol
12-Oct-2011
[2411]
Has anyone said the following before?

call-by-word
Endo
12-Oct-2011
[2412]
I didn't hear that before.
Geomol
12-Oct-2011
[2413]
I suggest: skip ++ and use NEXT with call-by-word to do the same. 
Less functions to remember that way.
Endo
12-Oct-2011
[2414]
using NEXT with call-by-word (I like the name :) ) looks ok to me, 
but I remember that, "guru"s may say "it leads performance overhead 
for next, as it is a native and used a lot. it should check the argument 
and get-value if it is a word."
Geomol
12-Oct-2011
[2415x4]
I'm not too sure about additional overhead, depending on how NEXT 
is implemented today. My guess is, NEXT already test for different 
datatypes, as it can handle blocks, strings, etc. To in that SWITCH 
(guessiong) in the source code, it just have to include the word! 
type also and handle that, and default: give the error.
To -> So
and *guessing* :) Getting late = more typing errors.
Then we could have things like:

>> a: 41
>> next a
== 42
>> a
== 41
>> next 'a
== 42
>> a
== 42
Endo
12-Oct-2011
[2419x2]
NEXT already test for different datatypes, as it can handle blocks, 
strings, etc.

But it's all series type. So no type checking I think. It supports 
only series and port values.
If it supports those actions, then it should be everywhere:

SKIP, ADD, DIV, NEXT, NEGATIVE, AND etc.. then it leads a overhead.
Geomol
12-Oct-2011
[2421]
I would guess, the code is different for doing next string, next 
block and next port.
Endo
12-Oct-2011
[2422]
I like the idea, but it looks it needs using too much GET value in 
all the actions above.
Geomol
12-Oct-2011
[2423x4]
Yeah, and some may argue, it's less readable with call-by-word options. 
But some probably also finds it strange, that NEXT string doesn't 
alter the string, while LOWERCASE string does.
A lot of things like

var: var + something	; or
var: add var something

could be changed to

add 'var something
It's kinda like the += in C.
'var + something
hmm... that's not too readable.
Endo
12-Oct-2011
[2427]
infix functions, op!s should not support this, because it is really 
not readable
Geomol
12-Oct-2011
[2428]
Yeah, I tend to agree.
Endo
12-Oct-2011
[2429]
what about writing a bunch of new functions suffixed with '
ADD'
NEXT'
Geomol
12-Oct-2011
[2430]
Yes, REBOL makes it possible to do all this already. In fact, all 
the natives could be recreated as mezzanines supporting call-by-name, 
but that'll be slow of course.
Endo
12-Oct-2011
[2431x3]
You can easily see the extra overhead:
SOURCE ++
additional IF, GET, SET and CASEs..
this should be in all the natives. look too much overhead I think.
Let's wait for comments from gurus.
I'm leaving now. Bye.
Geomol
12-Oct-2011
[2434]
ciao
Endo
13-Oct-2011
[2435]
There is a huge speed difference: (my benchmark function executes 
given block 1'000'000 times)
>> i: 0 benchmark [i: i + 1]
== 0:00:00.25
>> i: 0 benchmark [++ i]
== 0:00:02.578
Geomol
13-Oct-2011
[2436x4]
That's more the difference between a native and a mezzanine, than 
the method.
Related is using POKE on e.g. time!:

>> t: 10:20:30
== 10:20:30
>> poke t 2 42
== 10:42:30
>> t
== 10:20:30

But we can change a time using a set-path!:

>> t/2: 42
== 42
>> t
== 10:42:30

So the set-path! way doesn't do the same as POKE in this case.
That was in R2. In R3, POKE can't handle time!
And that's probably an ok decision.
Endo
13-Oct-2011
[2440]
That's more the difference between a native and a mezzanine, than 
the method.
 - That's right.
Geomol
13-Oct-2011
[2441]
From R3, where ++ is native::

>> dt [loop 10000000 [i: i + 1]]
== 0:00:01.90374
>> dt [loop 10000000 [++ i]]
== 0:00:01.011743
BrianH
13-Oct-2011
[2442]
Try it in R3:
>> dt [i: 0 loop 1000 [i: i + 1]]
== 0:00:00.000251
>> dt [i: 0 loop 1000 [++ i]]
== 0:00:00.000383


Then the difference is more due to the code in ++ to tell whether 
i is an integer or a series
Geomol
13-Oct-2011
[2443]
Hm, try do more loops on your system, Brian.