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

World: r3wp

[Core] Discuss core issues

Graham
4-Aug-2010
[17723]
in which case I might as well use 'either
Izkata
4-Aug-2010
[17724]
or use Maxim's 'only, just with a different value:
only: func [c b][if/else c b [copy {}]]
Graham
7-Aug-2010
[17725]
http://stackoverflow.com/questions/3400315/trigger-close-event-for-rebol-console/3402413#3402413


I think he's after the ctrl_close_event http://msdn.microsoft.com/en-us/library/ms683242(VS.85).aspx


though how he can detect it without any scripts running is beyond 
me.
So, is this detectable in the system port?
Ladislav
9-Aug-2010
[17726]
He obviously underspecified what he is after in the question.
Gabriele
9-Aug-2010
[17727]
Someone should point Carl to this, I'm pretty sure he wants to know: 
http://www.rebol.net/cgi-bin/rambo.r?id=4398&
Henrik
9-Aug-2010
[17728x2]
Notified him privately.
Gabriele:


Carl: "BTW, that REBOL example code is "C code" not REBOL. The crash 
occurs in GC due to a stack overflow. Works fine in R3. Ticket updated."
Anton
9-Aug-2010
[17730]
I don't understand how it is "C code". Anyone have any idea?
(And will R2 be fixed?)
PeterWood
10-Aug-2010
[17731]
I believe Carl is saying that in his opinion the code has been written 
in the style of C rather than making use of REBOL's language features.
Gabriele
10-Aug-2010
[17732]
Agreed that the code is "Javaish"... still, hard crashes are always 
worth fixing, you'll never know when they're going to bite you! (Maybe 
Carl should do a blog post explaining why that approach is bad and 
what is the alternative, most people get thaught that stuff in school 
and don't know better.)
Anton
10-Aug-2010
[17733]
Oh ok, I see. In that case, I'd like to see suggestions for how to 
do it more rebolishly. It doesn't immediately occur to me, not knowing 
the context for the code, how it should be better.

Another explanation could be that Carl is suggesting that such code 
(manipulating millions of vectors) makes more sense implemented in 
C (for higher performance), with rebol calling out to it.
Gabriele
11-Aug-2010
[17734]
Yes, that is a valid interpretation as well (things like that are 
not a good thing to do in REBOL). I do think that you can't give 
a more "rebolish" implementation without the context (that's the 
whole point of REBOL).
Graham
13-Aug-2010
[17735x2]
Is this helpful?

>> trim none

** Script Error: trim expected series argument of type: series port
** Near: trim none
What harm would there be in ignoring none?
Henrik
13-Aug-2010
[17737]
I guess it's about the propagation of NONE. If TRIM is used as part 
of a larger concatenated string, you could be forced to handle the 
NONE case after TRIM.
Nicolas
14-Aug-2010
[17738]
I'm having difficulty using the find function to find an image in 
an image. The image specification seems to indicate that this should 
be fine. Is this a known issue?
Henrik
14-Aug-2010
[17739]
Can you give an example where it doesn't work?
Nicolas
14-Aug-2010
[17740x6]
;Rule30
rule30: to-image layout/tight [box 6x1 yellow edge none]
foreach n [2 5 6] [poke rule30 n orange]

;Img
screen: system/view/screen-face

img: draw make image! screen/size  reduce ['pen 'yellow 'fill-pen 
'yellow 'box 0x0 screen/size]


img: at img img/size/x / 2
change img orange
img: at img -2x0
width: 3


it: copy/part rule30 3
find img it
;simpler

i1: make image! [60x60 #{FFFF00FFFF00FF960AFFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF}]
i2: make image! [3x1 #{FFFF00 FF960A FFFF00}]
find i1 i2
any thoughts?
Am I doomed to convert the image to binary?
;this works
find i1/rgb i2/rgb
Steeve
14-Aug-2010
[17746]
it's broken since a while
Graham
14-Aug-2010
[17747]
can someone rambo this?
Nicolas
14-Aug-2010
[17748]
how does one rambo?
Graham
14-Aug-2010
[17749]
http://www.rebol.net/cgi-bin/rambo.r

This is the bug database for R2 and before
Henrik
14-Aug-2010
[17750]
please check also if this bug exists in R3.
Nicolas
14-Aug-2010
[17751x2]
ok
check out this groovy cellular automaton I made with rebol  http://docs.google.com/leaf?id=0B37bnU84uDb5OGE4YWFiNzUtNmM4ZC00Zjg2LTg5OTYtMzMwNGYzNmMxNzE1&hl=en
Graham
14-Aug-2010
[17753]
view layout [ f1: field button "test" [ context [ view/new layout 
[ f1: field "testing" ]]] button "F1 value" [ probe f1/text ]]


why does the context not prevent the second f1 overwriting the first 
?
Henrik
14-Aug-2010
[17754]
because LAYOUT sets set-word!s globally. they don't exist in a particular 
context.
Gabriele
14-Aug-2010
[17755]
because make object! only scans for set-word!s in the main block, 
not sub blocks.
Graham
14-Aug-2010
[17756]
view layout [ f1: field button "test" [ use [ f1] [  view/new layout 
[ f1: field "testing" ]]] button "F1 value" [ probe f1/text ]]

this works though
Gabriele
14-Aug-2010
[17757x2]
>> context [do [f: 'something]]
>> f
== something
so you need context [f1: none view/new ....]
Graham
14-Aug-2010
[17759]
I don't want it to overwrite the f1 I have in the global context
Gabriele
14-Aug-2010
[17760x2]
see the VID-CONTEXT function here: http://www.colellachiara.com/soft/libs/utility.r
or, if you want a more general solution, see my implementation of 
modules: http://www.rebol.it/power-mezz/mezz/module.html
Graham
14-Aug-2010
[17762]
thanks .. you've got module for everything!
Gabriele
14-Aug-2010
[17763]
i guess 11 years of reboling pay off sometimes :-)
Graham
14-Aug-2010
[17764x2]
absolutely
so this is like a 'funct for layout
Gabriele
14-Aug-2010
[17766x3]
yes. it's still main block only iirc
but i found it very useful with VID
MODULE instead scan sub-blocks as well and preserves globals by copying 
them.
Henrik
14-Aug-2010
[17769]
I guess I was incorrect. 8 years of REBOLing is not enough.
Graham
14-Aug-2010
[17770]
how exactly do you use it?
Gabriele
14-Aug-2010
[17771x2]
layout vid-context [....]
it will make set-words in there local. i think i had a refinement 
to also get the context in case you need to access it...