World: r4wp
[Rebol School] REBOL School
older newer | first last |
MarcS 12-Oct-2012 [1393x4] | also, i get that x: [ append [] 1 ] then 'do x do x' differs from x: [ append copy [] 1 ] 'do x do x' |
henrik: so if i load the script, then do it, rather than doing the file? | |
makes sense, hadn't considered that | |
so: best practice is to consider everything to be inside a block, and hence copy even toplevel literals? | |
Henrik 12-Oct-2012 [1397] | not even needed. you may DO the same script several times for the same effect. |
Ladislav 12-Oct-2012 [1398x2] | in the a: [] it is so, that if you do not "reuse" the literal block then it does not matter whether you copy or not |
by "reuse" I mean if you do not keep the code and reevaluate it once again | |
MarcS 12-Oct-2012 [1400x4] | right |
but of course, | |
>> x: load %foo.r == [ foo: [] append foo 1 ] >> do x == [1] >> do x == [1 1] >> foo == [1 1] | |
which was henrik's point | |
Henrik 12-Oct-2012 [1404] | actually not |
MarcS 12-Oct-2012 [1405] | oh! |
Ladislav 12-Oct-2012 [1406] | and by "keep the code" I mean "keep the code as a block", if you keep it as a string then it does not matter |
Henrik 12-Oct-2012 [1407] | do %foo.r do %foo.r will produce something you may not intend. |
MarcS 12-Oct-2012 [1408x4] | well, if there are side effects, sure |
but with the above, i get the anticipated result, | |
>> do %foo.r Script: "Untitled" (none) == [1] >> do %foo.r Script: "Untitled" (none) == [1] >> foo == [1] | |
ladislav: yep, understood | |
Henrik 12-Oct-2012 [1412] | sorry, MarcS. you are right again. I better take a nap... |
MarcS 12-Oct-2012 [1413x2] | so to get back to pitfall vs. stylistic - i notice that carl's scripts (makedoc, blog) tend not to copy 'global' literals |
whereas, for example, the source for vanilla does | |
Ladislav 12-Oct-2012 [1415] | However, when writing something like: a: [] into a file, you may not be totally sure that somebody does not LOAD your code and try to evaluate it twice.... |
MarcS 12-Oct-2012 [1416x2] | yep |
so unless you're certain (!) that that won't occur, better to be safe and copy? | |
Ladislav 12-Oct-2012 [1418] | Yes, copy looks safer.... |
MarcS 12-Oct-2012 [1419] | thanks for the help |
Endo 17-Oct-2012 [1420x2] | Henrik: I've registered on http://hmkdesign.dkBugs database (curecode), I got an error when I create a new account but I think it created my user. Can you check it please? My username is "endo". |
I've setup a new Cheyenne (r179) with html-008.r included, playing with html dialect. | |
Henrik 17-Oct-2012 [1422] | now validated... also validated 3 other registrations from 2009... I guess they are in for a surprise email. :-) |
Sunanda 31-Oct-2012 [1423] | Why can't a button hide itself? Looks like /SHOW? is always set TRUE on exit from an action facet: view layout [b: button "hide me" [hide b print b/show?]] (esc) print b/show? ;; expect FALSE if button clicked, but always get TRUE My ungainly work-around is to move the button well out of the visible area: view layout [b: button "hide me" [b/offset: -100x-100 - abs b/offset show b]] (the abs and -100s allow me to reverse the action to put it back where it was) |
Henrik 31-Oct-2012 [1424] | AFAIK, it's because the action is run on mouse down, and the mouse up event causes a redraw, which will then show the button again. |
Maxim 31-Oct-2012 [1425] | action is run on mouse up. I can't figure out why face won't stay hidden... but its probably because Carl used redraw. first thing I do when I build new styles is to clear the redraw. |
Henrik 31-Oct-2012 [1426] | you are right. the problem is probably that the action is run before the redraw takes place. but it's been a few years now since I worked on this problem. |
Maxim 31-Oct-2012 [1427x3] | IIRC feel/redraw does a show on a face which forces it back on. |
just about every time I've had to fix something with VID it was related to the fact that redraw is being used. its a very bad design... redraw should never have been put into the feel. its also a big slowdow, since it forces every face to redraw itself when you show a pane. | |
slowdown | |
MaxV 31-Oct-2012 [1430x2] | A button can remove itself: lokk here: a: layout [b: button [remove find a/pane b show a]] view a |
Did you understand how it works? | |
Maxim 1-Nov-2012 [1432] | but here you removed the button... hiding it , leaves it there. |
Sunanda 2-Nov-2012 [1433x4] | Thanks guys...MaxV that's the overkill solution :-) |
Another question ... I'vd like a field action facet to be triggered on field exit. But I can find two cases (under windows) when it isn't: 1. ctrl+tab out of the field, rather than tab 2. right click another face, eg a button view layout [field 100x100 [print "field was exited"] button "click me" [print 'left] [print 'right]] Any ideas for making the field action trigger in all cases? Please! (Right now my workaround is to do a bulk check on all fields when the user clicks a main action button like SAVE, but that means they may see multiple field-exit messages all at once, and later than they'd expected). | |
(oops new VIEW/VID group now open for such questions). | |
Any good reason why DEHEX won't touch %00 ? It's the only one of the 256-single-byte values it leaves hexed rather than dehexed dehex "%00 %6f%64%64%3f" | |
Maxim 2-Nov-2012 [1437] | that is a strange bug |
Sunanda 2-Nov-2012 [1438] | Yes, it is thanks. I stumbled across a case where I had to run DEHEX twice because it skipped a few values the first time. Sadly, not been able to replicate that in a one-liner, so it may have been something stupid I did. |
BrianH 2-Nov-2012 [1439] | Works in R3. |
Maxim 2-Nov-2012 [1440x2] | it is a bug in R2 2.7.8 |
nice that its fixed in R3 | |
BrianH 2-Nov-2012 [1442] | Just 2.7.8? Not earlier versions? |
older newer | first last |