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

World: r3wp

[Core] Discuss core issues

Graham
6-Jul-2010
[17260]
No, it's a bug
Maxim
6-Jul-2010
[17261]
note, they are not evaluated, even if you replace them with functions 
which have the same word.
Graham
6-Jul-2010
[17262x3]
works correctly in R3 but not in R2
this is r3

>> a: construct [ a: true b: on c: yes ]
== make object! [
    a: true
    b: true
    c: true
]
Where are r2 bugs posted these days??
Maxim
6-Jul-2010
[17265]
still rambo.
Graham
6-Jul-2010
[17266]
Just downloaded 2.7.7 to be sure that the bug is still there and 
it is
Endo
6-Jul-2010
[17267]
yep, it is still there, I use 2.7.7.
I use this function to test:
f: func ['w] [type? get in construct compose [t: (:w)] 't]
>> f yes
== word!
>> f off
== logic!

forum topic is "Careful when Construct an object" on http://rebolforum.com, 
above link goes another topic. (a bug on forum, topic numbers changing)
Graham
6-Jul-2010
[17268]
I posted the bug report
Vladimir
6-Jul-2010
[17269]
Thanks Gregg!!! It works just the way I need it to work :)
BrianH
6-Jul-2010
[17270x5]
The yes and no keywords of R3's CONSTRUCT were added at my request. 
We'll have to see whether the enhanced function can be backported 
to R2 safely. There are other changes as well, mostly safety changes, 
and a CONSTRUCT/only option that turns all of the tricks off.
Bug#651 details the changes - yes and no keywords, and unset-to-none 
translation - and bug#687 explains CONSTRUCT/only.
We'll have to see if there is any R2 code that will be broken by 
the change; if so, it won't happen. As a rule, backwards-incompatible 
changes are only made to R2 when they can be proven to not harm legacy 
code. There have been a few exceptions, and at least one mistake 
that predated (and inspired) the rule, but the exceptions have all 
been added functionality that doesn't change old functionality that 
is relied on in code. If nothing relies on yes and no not being keywords, 
or unset! values not being translated to none, then we're cool. As 
a counter-example, CONSTRUCT/only could be backported without question 
because it's a new option.
One caveat to new options: Once APPLY is backported (planned for 
2.7.8) then new options will need to be added to the end of the options 
list of functions, not in the middle. APPLY is positional when it 
comes to options.
This is already a concern for those using the R2/Forward backport 
of APPLY.
Pekr
8-Jul-2010
[17275x2]
What is the easiest way to prevent sub-object sharing? I have very 
simple but nested XML structure, and I want to put records into objects. 
But I have one subobject. I want to have prototype object (class) 
and create instances filled with data, but I want to avoid subobject 
sharing ....
simply put: proto: context [name: none address: context [street: 
none]], and now I want to make instances, but those should not share 
address subobject ...
Anton
8-Jul-2010
[17277]
You're going to have to clone the subobjects, eg.
	instance1: make proto [
		address: make address []  ; Clone object to avoid sharing.
	]
Ladislav
8-Jul-2010
[17278]
Just define your own constructor, that is all
Pekr
8-Jul-2010
[17279]
Ah, thank you very much ... I thought I could somehow avoid that, 
but that's ok ....
Maxim
8-Jul-2010
[17280x2]
I put an init function in the class, and do any stuff there, then 
its much easier to manage.

a: make class [init]
you can also make a function which call init , if its there.


new: func[class spec /local obj][obj: make class spec if function? 
get in obj 'init [obj/init]]
Steeve
8-Jul-2010
[17282]
if you keep the prototype as a block you don't need to do so
>> context proto
Ladislav
8-Jul-2010
[17283]
Nevertheless, the "use your own constructor" variant is the only 
"truly object-oriented" one
Maxim
8-Jul-2010
[17284]
yes, my above one-line constructor func scales very well, since you 
can call new on sub-objects too, and it will take care of any things 
like creating empty new blocks and formatted strings on the fly, 
within the init func.
Ladislav
8-Jul-2010
[17285x2]
My suggestion would be more like:

my-class: make object! [
    new: func [...] [...]
]

my-class-instance: my-class/new ...
, but, you can use whatever suits your needs
Maxim
8-Jul-2010
[17287]
yes, the power of rebol to define our own models  :-)
Henrik
10-Jul-2010
[17288]
How is it again that one decodes a url? Sometimes I forget the simple 
things.
Graham
10-Jul-2010
[17289]
dehex ?
Henrik
10-Jul-2010
[17290]
thanks
amacleod
10-Jul-2010
[17291]
Is there something like "unmold"? I find myself needing to return 
a molded block back to a block all the time.
Henrik
10-Jul-2010
[17292]
load
amacleod
10-Jul-2010
[17293]
dope
Henrik
10-Jul-2010
[17294]
remember to MOLD/ALL if you don't want to lose information.
Demitri
10-Jul-2010
[17295]
I have r2 question.  I wont to convert integer value to binary but 
it comes out wrong.  Some tell me how?  The integer is above 255.
Graham
10-Jul-2010
[17296]
Tell us what you are doing
Demitri
10-Jul-2010
[17297]
I trying to convert integer value to binary.
Izkata
10-Jul-2010
[17298]
>> debase/base to-hex 512 16
== #{00000200}
Demitri
10-Jul-2010
[17299]
thx you Izkata.
Anton
10-Jul-2010
[17300]
Dope doesn't work that well.
Ladislav
14-Jul-2010
[17301]
I think, that everybody processing REBOL strings using REBOL shall 
be aware of CureCode #1632. I should probably write an article about 
the subject somewhere to make life of at least some people easier.
Anton
14-Jul-2010
[17302]
Yes, it's a pity MOLD isn't the one which is the least "lossy" (vs 
MOLD/ALL) when it comes to serialising.
What can be done about it at this stage, though?
Maxim
14-Jul-2010
[17303x2]
thing is load isn't the counterpart to mold.  'DO is.   and even 
then, even MOLD/ALL isn't a real serialization because shared objects, 
or series aren't shared anymore.


although they go a long way, and I have been using them extensively 
in many tools, MOLD & MOLD/ALL are just helpers, destined for advanced 
users who have very special requirements.
we need to build a REAL serialization dialect, one which rebuilds 
the data sharing, even in nested and co-occuring references to series 
and objects.
Steeve
14-Jul-2010
[17305]
it's rebin
Maxim
14-Jul-2010
[17306x2]
but we should not be forced to use a binary dataset for such things. 
 it can be expressed in source format.
just added an (very succinct) extended serialization example which 
would allow us to basically fix all the MOLD issues on LOAD directly. 
 it could be the basis for rebin, which could just be a compressed 
version of the source version to keep it (very) small.
Steeve
14-Jul-2010
[17308]
just added ?
Maxim
14-Jul-2010
[17309]
to curecode.