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

World: r3wp

[Core] Discuss core issues

BrianH
29-Apr-2008
[10353]
In your version, the syntax error was at load time, before the attempt 
was called.
[unknown: 5]
29-Apr-2008
[10354]
This isn't good for dynamic data.  If something is populated dynamically 
then would have to account for the spaces and check the dynamic data.
BrianH
29-Apr-2008
[10355]
>> mold [ < ]
== "[<]"
[unknown: 5]
29-Apr-2008
[10356x2]
Yeah but that isn't acceptable for me.
I would classify that as a workaround and the problem still to be 
a bug.
BrianH
29-Apr-2008
[10358]
I said it was unfortunate :(
[unknown: 5]
29-Apr-2008
[10359]
hehe
BrianH
29-Apr-2008
[10360]
It used to be the case for to-file "" too.
[unknown: 5]
29-Apr-2008
[10361]
ahhh well hopefully we can get it fixed.
BrianH
29-Apr-2008
[10362]
>> [>]
== [>]
Not a problem for <
[unknown: 5]
29-Apr-2008
[10363]
Yeah just the one needs fixed then.
BrianH
29-Apr-2008
[10364]
>> [<
[    ]
== [<
]
[unknown: 5]
29-Apr-2008
[10365]
yeah that is why I need the mold to trim the lines from something 
like that.
BrianH
29-Apr-2008
[10366x2]
>> [ < ]
== [<]
>> new-line [ < ] true
== [
    <
]
Same value, different display.
[unknown: 5]
29-Apr-2008
[10368]
>> c
== "[<]"
>> d: []
== []
>> append d to-word c
== [[<]]
>> e: first d
== [<]
BrianH
29-Apr-2008
[10369x2]
>> mold new-line [< ] true
== "[^/    <^/]"
It's a little longer, but at least it will load and have the same 
value.
btiffin
29-Apr-2008
[10371]
On this I tried    a: pick first system/words 122   (umm 122 will 
vary of course)  
b: make binary! 0     save/all b a   c: to block!  b
BrianH
29-Apr-2008
[10372]
>> new-line load mold new-line [< ] true false
== [<
]
>> mold new-line load mold new-line [< ] true false
== "[<^/]"
[unknown: 5]
29-Apr-2008
[10373x2]
I'm staying away from load
just for my purposes anyway
BrianH
29-Apr-2008
[10375]
As long as you control the save, load is all right
[unknown: 5]
29-Apr-2008
[10376x2]
I think appending might be my solution for my purposes.
I can't have the newline in the block.
BrianH
29-Apr-2008
[10378]
Right, you read/lines.
[unknown: 5]
29-Apr-2008
[10379]
Thanks guys, I think I got a solution.
BrianH
29-Apr-2008
[10380]
Cool.
btiffin
29-Apr-2008
[10381]
Cool;  A little background for Brian's sake.  I bumped into this 
trying to move my LOCATE routine to TRETBASE so I was using system/words 
as a source for testing.  Didn't make it past entry 122  <   to lit-word! 
 didn't make it past 111  '/   kakks too.
BrianH
29-Apr-2008
[10382]
If you think that's bad, look at this:
>> [<]>]
== [<]>]
[unknown: 5]
29-Apr-2008
[10383]
hehe I'm dizzy
BrianH
29-Apr-2008
[10384]
>> length? [<][>]
== 1
btiffin
29-Apr-2008
[10385]
Nice tags.   :)   Leave it to Mr Hawley to get the crux
[unknown: 5]
29-Apr-2008
[10386]
Sees it as a tag
BrianH
29-Apr-2008
[10387]
Nasty, eh? :)
[unknown: 5]
29-Apr-2008
[10388x2]
yes ;-)
I think I'm on to something in REBOL and I want some input on this. 
 If I define a block in a function such as:


my-func: func [data /local blk][blk: copy []  append blk data print 
blk clear blk]


Now even though blk is cleared will the memory still be allocated 
to the size the blk expanded to accomodate the data argument?


If so, instead of clearing blk would it be better to unset or set 
blk as none at the completion of the function?  I'm just guess that 
REBOL's garbage collector wouldn't want to clear the memory allocation 
of blk since it doesn't seem efficient to do so.
BrianH
29-Apr-2008
[10390]
That kind of thing was the original motivation for the ALSO function. 
Try this:

my-func: func [data /local blk][blk: copy []  append blk data print 
blk also blk blk: none]
[unknown: 5]
29-Apr-2008
[10391x2]
forgot what the source of also looked like.  I might need to load 
2.7.6
So is the fix really to just set blk to none?
BrianH
29-Apr-2008
[10393x2]
also: func [
    {Returns the first value, but also evaluates the second.}
    value1 [any-type!]
    value2 [any-type!]
][
    get/any 'value1
]
Yes, that is the fix. You should also set data to none.
[unknown: 5]
29-Apr-2008
[10395]
Yeah good point.  So we really don't need ALSO to free the memory 
then right?
BrianH
29-Apr-2008
[10396]
ALSO is to let you return a value assigned to a variable, and still 
be able to unset the variable.
[unknown: 5]
29-Apr-2008
[10397x2]
Thanks Brian.
Why was ALSO created?
BrianH
29-Apr-2008
[10399]
For cleanup.
[unknown: 5]
29-Apr-2008
[10400x2]
I don't fully comprehend the also function.  I know it is getting 
the value but why pass it twice?
so really you would always want the second value to be word: none 
correct?
BrianH
29-Apr-2008
[10402]
It's an evaluation trick. It evaluates two expressions and returns 
the value of the first. You can do your cleanup in the second expression. 
If your cleanup is more complex, put it in a paren. The value returned 
by the second expression is taken and ignored.