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

World: r4wp

[!REBOL3] General discussion about REBOL 3

GiuseppeC
9-Apr-2013
[2327]
I think it could be a good start. However, Ladislav usualli works 
on REBOL wiki.
Gregg
9-Apr-2013
[2328x3]
I'm not waiting for anything in particular WRT R3. I am very anxious 
to have time to start using it more, and I am grateful to the Saphirion 
team for taking the lead on it and doing so much work. Because they 
have, I decided that what time I can make right now I will put behind 
Red, as I think I can provide more value there, and to give Doc some 
support for all his work too.
I'm also going to post more thoughts and questions about funcs, like 
I did with SPLIT-PATH, because now is the time to make any changes, 
IMO.
Ren is a new distraction now too. :-) But I think it will be good 
for all of us.
MaxV
11-Apr-2013
[2331]
Please, may you add some examples in the following pages?
http://rebol.informe.com/wiki/view/Rebol_3-set-face
http://rebol.informe.com/wiki/view/Rebol_3-get-face
Ladislav
13-Apr-2013
[2332x4]
How do you like this "Implementation artefact":

f: make function! reduce [[x /local x-v y-v] body: [
	x-v: either error? try [get/any 'x] [
		"x does not have a value!"
	] [
		rejoin ["x: " mold/all :x]
	]
	y-v: either error? try [get/any 'y] [
		"y does not have a value"
	] [
		rejoin ["y: " mold/all :y]
	]
	print [x-v y-v]
]]

g: make function! reduce [[y /local x-v y-v] body]

>> f 1
x: 1 y: 1
(specailly Andreas should have a look)
Just for comparison, these results are from R2:

f: make function! [x /local x-v y-v] body: [
	x-v: either error? try [get 'x] [
		"x does not have a value"
	] [
		rejoin ["x: " mold/all :x]
	]
	y-v: either error? try [get 'y] [
		"y does not have a value"
	] [
		rejoin ["y: " mold/all :y]
	]
	print [x-v y-v]
	unless value? 'y [g 2]
]

g: make function! [y /local x-v y-v] body

>> f 1
x: 1 y does not have a value
x does not have a value y: 2
http://issue.cc/r3/2025
Andreas
13-Apr-2013
[2336]
Very good catch, Ladislav. A rather nasty bug.
Ladislav
13-Apr-2013
[2337]
(remedy is not hard, already found out how to correct it)
Andreas
13-Apr-2013
[2338]
Point the "frame" to the full function value instead of just the 
function's body.
Ladislav
13-Apr-2013
[2339x2]
- not exactly
(that would be quite incomfortable)
Andreas
13-Apr-2013
[2341]
Interested in any alternative fixes, but I see no discomfort for 
the above.
Ladislav
13-Apr-2013
[2342x2]
Well, there is some discomfort. REB_FUNCTION values are not garbage 
collected.
However, fortunately, the ARGS series is unique to function (since 
it is created specifically for the function), so it can be used instead 
of the body.
Andreas
13-Apr-2013
[2344]
That's indeed rather annoying. Seems the GC leaves much to be desired.
Ladislav
13-Apr-2013
[2345]
(even if two functions have the same SPEC and BODY, they always have 
distinct ARGS)
Andreas
13-Apr-2013
[2346]
Ok. That's better (even though it is a somewhat ugly hack).
Ladislav
13-Apr-2013
[2347]
Well, but the fact that REB_FUNCTIONs don't need GC is not ugly IMO.
Andreas
13-Apr-2013
[2348x2]
One negation too much.
(Meaning: sorry, I'm not sure I understand what you are trying to 
say.)
Ladislav
13-Apr-2013
[2350x3]
You mean you dislike it?
Integers, decimals, REB_FUNCTIONS, whatnot... don't need GC.
Only series and GOBs need GC
Andreas
13-Apr-2013
[2353x3]
Quite fortunate that you know already know enough of the GC to not 
mistakenly walk down the wrong road.
I didn't yet check how REB_FUNCTIONs are created, but why should 
they _not_ be GC'd?
Are they pooled or managed using a custom allocator?
Ladislav
13-Apr-2013
[2356]
Exactly for the same reason why integers do not need GC. They are 
not allocated, so they don't need deallocation
Andreas
13-Apr-2013
[2357x3]
Ah, so they can only be contained within a series.
Ok.
(Or a gob, maybe.)
Ladislav
13-Apr-2013
[2360x2]
Yes, the reason why GOBs needed GC was that they did not fit within 
128 bits.
(GOB is 512 bits)
Andreas
13-Apr-2013
[2362]
So there's a "gob reference" value type?
Ladislav
13-Apr-2013
[2363]
Yes
Andreas
13-Apr-2013
[2364]
Ah, I see. A "gob value" is just a pointer to the real gob structure.
Ladislav
13-Apr-2013
[2365]
REBGOB (the part needing GC) is 512 bits, while Reb_Gob (fits within 
128 bits and points to a REBGOB)
Andreas
13-Apr-2013
[2366x2]
REBGBO! :)
Thanks for clarifying.
Ladislav
13-Apr-2013
[2368x3]
Yes, sorry, it is just struct Reb_Gob called REBGBO.
BTW, REBGBO looks quite ugly to me
(I mean just the name)
Andreas
13-Apr-2013
[2371x2]
Maybe REBGBI (in analogy to REBSRI) would be better?
Is the "index" field of REBGBO presently used?
Ladislav
13-Apr-2013
[2373x4]
yes
you can write:

next gob
So, actually, the "full GOB" is 544 bits, not just 512
(when summing REBGOB and REBGBO while subtracting the pointer.