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

World: r3wp

[rebcode] Rebcode discussion

Volker
15-Oct-2005
[450x2]
Carl mentioned everything is traded for speed.
Btw speed, little benchmark rebol, rebcode, c: http://polly.rebol.it/test/test/rebcode/download.r
BrianH
15-Oct-2005
[452]
They'll never get REBOL secure if you can cause core dumps with rebcode.
Volker
15-Oct-2005
[453]
Maybe rebcode is not enabled then, or there are two different interpreters.
BrianH
15-Oct-2005
[454x2]
Core dumps on Windows are caused by unintentional buffer overflows 
and such. If you can cause them unintentionally, you can cause them 
intentionally.
There are some things you shouldn't trade for speed.
Volker
15-Oct-2005
[456x3]
Personally i agree. OTOH lots of other apps do that trade too.
If you want to do multimedia, either trade or have a very smart compiler.
and the rebcode-portions should be a small part of the programm. 
And i guess often generated by dialects. which will add checks on 
their own, which is why we have this range-checks now (IMO)
BrianH
15-Oct-2005
[459x3]
Well yes, I want to make a very smart compiler as much as the next 
guy, but still I like the invalid-as-noop behavior that many of these 
opcodes have, that all of them should have.
At least invalid-as-error would do, rather than invalid-as-crash.
Heck, in debug mode I would like all of the opcodes to act as invalid-as-error.
Henrik
15-Oct-2005
[462]
hmm.. does IF work?

r: rebcode [] [
  set a -1
  lt a 0
  either [return a][return 0]
] ; works

r: rebcode [] [
  set a -1
  lt a 0
  if [return a]
] ; syntax error
Volker
15-Oct-2005
[463x2]
ift, iff (it-true, if-false)
(why not if, unless?)
Henrik
15-Oct-2005
[465]
ah, silly me. knew I shouldn't have read the docs :-)
BrianH
15-Oct-2005
[466]
Maybe they use ift, iff to empharize that they don't work like REBOL 
if, unless, that they operate on condition codes?
Volker
15-Oct-2005
[467]
But that is true for pick and such true. i mean different args but 
same name. maybe saves typing?
BrianH
15-Oct-2005
[468x3]
Could be an assembly thing :)
brat and braf are like that
And they came first - the inner block thing came later.
Geomol
17-Oct-2005
[471]
How do I break out of a loop? This won't work:
until [
eq a 0
ift [break]
...
]
Sunanda
17-Oct-2005
[472]
Break will exit an 'until:
    until [ break 1 = 4]  ;; does not loop forever.
Have you redefined 'break somehow
Ladislav
17-Oct-2005
[473]
this looks like a special case
Geomol
17-Oct-2005
[474]
Sunanda, I'm talking rebcode! Isn't your example non-rebcode?
Ladislav
17-Oct-2005
[475]
G: try until [eq a 0 braf 1 break ...]
Sunanda
17-Oct-2005
[476]
Whoops!! Sorry!
Geomol
17-Oct-2005
[477]
Ladislav, thanks! That did the job.
Pekr
17-Oct-2005
[478]
rebcode now seems to be regarded an alpha version. Initial release 
contained some fine docs, not included with later experimental releases. 
Will new extended docs come?
shadwolf
17-Oct-2005
[479x2]
Personal tought on REBCODE: "sniiiiiiiiiiiiiiiiiiiiiiiiiiiif don't 
toutch my rebol it looks like ASM sniiiiiiiiiiiif my poor reeeeeeeeeeeeeeeeboooooooooooool 
is all broken  :
                           set i 1
		eq i 1
		braf fail
		brat continue
		print "Should not print!"
		label continue
Sniiiiiiiiiiiiiiiiif "

but performances are great ...
With rebcode we loose on of his key feature the simplicity ... But 
for some tasks really precise that needs high perfs it's great to 
have such a tool . I don't kno yet if i ill use it every day...
Ladislav
17-Oct-2005
[481]
you surely shouldn't
Kaj
17-Oct-2005
[482]
I like the brat and barf instructions :-)
shadwolf
17-Oct-2005
[483]
but it looks not like rebol anymore  ...
Ladislav
17-Oct-2005
[484]
the fun is, that it is REBOL. Have you seen the Alien Dialect?
BrianH
17-Oct-2005
[485]
I still think it's pretty simple, by assembler standards. Have you 
seen x86 assembler?
Kaj
17-Oct-2005
[486]
Urgh
BrianH
17-Oct-2005
[487]
In rebcode, every instruction has just one addressing mode, does 
just one thing. Count your blessings when you can.
shadwolf
17-Oct-2005
[488]
Yeah i do a lot of asmx86 but ... I don't like that even if you get 
a close controle on what you are doing
Pekr
17-Oct-2005
[489]
shadwolf - the nice thing is, that for specific domain, you can create 
your own sub-language using parse and let it generate rebcode for 
you :-)
BrianH
17-Oct-2005
[490]
For some kinds of coding I would actually find rebcode to be a more 
comfortable dialect. For instance, you don't have to worry about 
whether someone has redefined add.
Pekr
17-Oct-2005
[491]
shadwolf - really no reason to use it on a daily basis, but cool 
to have for fast tasks - without it real-time image manipulation 
in rebol was impossible for e.g.!
BrianH
17-Oct-2005
[492x2]
At least in this case, you can count on any crashes or security holes 
being your fault instead of someone else's.
Kaj, I have found myself amost writing brat and barf many times already. 
I guess my inner child has a dirty mind :)
shadwolf
17-Oct-2005
[494x2]
yea i know the complain message (1st one ) what for joking  ^^
things like list sorting in widgets like table or listview in rebgui 
could profit form rebcode optimisation
BrianH
17-Oct-2005
[496x4]
On the note of people redefining stuff out from under you, here's 
a quick redefine that can make the user-defined rewrite rules a little 
safer:

rebcode: func [
    "Create and return a rebcode VM function."
    args [block!] body [block!]
    /rewrite rules [block!]
][
    either rewrite [
        rewrite: tail rebcode*/userdef-rule
        rebcode-define rules
        make rebcode! args body
        clear rewrite
    ] [
        make rebcode! args body
    ]
]
It uses internal features, and so may have to be adjusted features 
as the assembler is refined.
Sorry, it uses internal features, and so may have to be adjusted 
as the assembler is refined.
Whoops, slight adjustment needed :(

rebcode: func [
    "Create and return a rebcode VM function."
    args [block!] body [block!]
    /rewrite rules [block!]
][
    either rewrite [
        rewrite: tail rebcode*/userdef-rule
        rebcode-define rules
        body: make rebcode! args body
        clear rewrite
        :body
    ] [
        make rebcode! args body
    ]
]