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

World: r3wp

[!REBOL3]

PatrickP61
16-Dec-2010
[6671]
Thank you Rebolek -- I'll check that out.
Oldes
18-Dec-2010
[6672]
Let's have:
	o: context [a: 1 b: 2]
I can do:
	values-of o ;== [1 2]

Can I update these values somehow to get o == make object! [a: 3 
b: 4]  just using block of values [3 4]?
BrianH
18-Dec-2010
[6673]
v: values-of o
... change v ...
set o v
Oldes
18-Dec-2010
[6674]
Great... and it is possible in R2 as well.. I'm still learning:)
Steeve
18-Dec-2010
[6675x2]
shortcut:
get o 
== [1 2]
if you want to set an object with another one, better to use
resolve/all o1 o2
Oldes
18-Dec-2010
[6677]
I wanted to avoid using objects as an extension's command argument, 
but I decided that it will be more user friendly to use object directly 
anyway... more work on C side, but it worths for it.
Awi
20-Dec-2010
[6678]
Is there a reason why map! does not allow date!, time! or pair! as 
keys?
Oldes
20-Dec-2010
[6679]
Is there a reason why codecs (like image loading) are not in host 
part?
Pekr
20-Dec-2010
[6680]
Oldes - AFAIK, codecs are going to be completly overhauled. We wanted 
streaming support, and current implementation is imo rather primitive. 
Carl agreed in one roadmap document release, but that file is gone 
(we are waiting for new one). I hope proper port based API will be 
available. So - on one hand it is a good thing it is not part of 
the host-kit, as we arelly need one standardised API, not myriad 
of different hack-ins, but otoh Carl could benefit from some community 
experiments in that regards ....
Henrik
20-Dec-2010
[6681]
Just curious: Is there a maximum length to a word name? can you TO-WORD 
a 1 GB string, assuming it's valid?
Maxim
20-Dec-2010
[6682]
easily checked with a little powers of two loop ;-0
Henrik
20-Dec-2010
[6683]
don't have the memory :-)
Steeve
20-Dec-2010
[6684]
have a break :-)
Henrik
20-Dec-2010
[6685]
I'm writing docs. Just getting warmed up. :-)
Sunanda
20-Dec-2010
[6686]
Max word lenth is 255 or 256 in R3
Henrik
20-Dec-2010
[6687]
ok, thanks. that's fair enough.
Sunanda
20-Dec-2010
[6688]
http://www.curecode.org/rebol3/ticket.rsp?id=580&cursor=1
Steeve
20-Dec-2010
[6689]
Btw Henrik, I read your GUI R3 code. It's R2 fashioned. You missed 
some R3 tricks. I suppose you already know it though ;-)
Henrik
20-Dec-2010
[6690]
Steeve, depends on which parts you read.
Steeve
20-Dec-2010
[6691x4]
I give some examples.
The 'merge-values mezz is actually like the native 'resolve
you use a lot the old idiom
select block 'word 
vs
block/:word (which is faster and more compact)
(sorry it's: select block word)
Henrik
20-Dec-2010
[6695]
it's quite possible that some functions are from the original R3 
GUI, long before newer tricks were involved.
Steeve
20-Dec-2010
[6696x2]
Another old R2 idiom:
all [in object 'property object/property]
vs
select object 'property
var: either cond [...][none]
vs
var: if cond [...]
Henrik
20-Dec-2010
[6698]
hmm... yes, that is old
Steeve
20-Dec-2010
[6699x5]
But you know, We all are in the same trend, It will take a while 
before we loose old habits
Today, I saw something horrific in an old script of mine.
>> 8 * to-integer v1 + v2 / 8
V1 and V2 are actually integers
(not related specificaly to R3)
I let you think about this coding horror ;-)
Kaj
20-Dec-2010
[6704]
Was that R1 semantics? ;-)
Gregg
20-Dec-2010
[6705]
I wouldn't always use the IF version in place of EITHER. I generally 
prefer to be explicit.
BrianH
20-Dec-2010
[6706]
We use that IF or UNLESS returning none trick a lot. It is used so 
much that it might as well be considered explicit. It is good to 
remember that REBOL doesn't have an optimizer; we have to optimize 
by hand, and the IF trick is faster than the explicit EITHER.
Gregg
20-Dec-2010
[6707]
It is used so much that it might as well be considered explicit.

As is my preference for avoiding premature optimization. ;-)
BrianH
20-Dec-2010
[6708x5]
On that note: Steeve...
>> a: [a 1]
== [a 1]
>> a/:b
** Script error: :b has no value
>> select a 'b
== none
It's the same thing as the SELECT object word trick.
Gregg, don't avoid optimization altogether in the name of avoiding 
"premature" optimization :)
A better aphorism to use here would be to avoid being "penny wise 
but pound foolish" - it makes your point better :)
Gregg
20-Dec-2010
[6713]
Agreed on optimization being required at times. Not loading lots 
of data? Yes. Using a hash instead of a block? Yes. I have even avoided 
the mezz loop constructs at times, though more often for clarity 
than performance. 


Maybe I'm a special case, but I have rarely found the need to optimize 
my REBOL code for performance at this level. And I can safely say 
I have never ever, ever optimized out EITHER for IF. Since you said 
it's used a lot, what code should I look at to see how and why? I'm 
always happy to see what I've been missing.
BrianH
20-Dec-2010
[6714]
It's used in mezzanines, for instance. I tend to just write code 
in micro-optimized form in the first place, since it is easy to do 
and saves you the trouble of doing it later. Even if you are macro-optimizing 
the code (refactoring and such) you tend to use the same micro-optimizations 
in the new code. For that matter, many of the changes and enhancements 
in R3 were done to make micro-optimized code cleaner to read and 
write than they are in R2. But I mostly write library and mezzannine 
code nowadays, so micro-optimization has greater impact than it would 
for user-level code.
Ladislav
20-Dec-2010
[6715]
Two notes:

- I optimize for code size, using IF, or UNLESS

- the average speed-up looks like being about 27%, though, which 
is worth considering
BrianH
20-Dec-2010
[6716x2]
Interesting: That's the same speedup that referencing words from 
object contexts gives you, relative to function contexts.
Agreed: Less code means less code to maintain and debug :)
Ladislav
20-Dec-2010
[6718]
I wonder, what is the purpose of the --- function, did not suceed 
to find that out.
BrianH
20-Dec-2010
[6719]
>> same? :--- :comment
== true
Ladislav
20-Dec-2010
[6720]
aha, thanks