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

World: r3wp

[Core] Discuss core issues

BrianH
17-Jul-2007
[8506x2]
Otherwise (in R2) the function SOMETHING will retain the value of 
the word a until the SOMETHING function is called again, or is itself 
collected. If that value is large it could be a problem - hence the 
really large value in my example.
In R3 those words are cleared on function return, so that particular 
problem doesn't arise. There are other kinds of cleanup that AFTER 
can help with though.
Geomol
17-Jul-2007
[8508x4]
I situations with strings (or series in general) like that, I use 
to put the function and the variable in a context and do
clear a

when it's needed. That way I reuse the mem area. Would I need the 
after function? hmm ...
I have never used such technique, but I'll consider it.
To make it clear, I would do something like:

context [
a: ""

something: does [clear a  ... ]     ; do something with a, maybe 
filling it with lots of data or whatever
]
There should of cource be some more code before the end bracket ending 
the context. It was just to illustrate.
Gabriele
17-Jul-2007
[8512]
doc, stats decreases, however size in task manager seems to stay 
the same, so i don't know if memory is actually deallocated or kept. 
maybe the os keeps it for the process.
Dockimbel
17-Jul-2007
[8513x2]
if you play a little more with this example allocating big buffers 
then releasing them, you'll see memory used going up and down (I 
even could go back close to initial state after something like  a: 
make string! 100'000 recycle). So REBOL releases some parts to OS, 
but it's hard to predict how much and when...
(watching in task manager)
Geomol
19-Jul-2007
[8515]
What is PATH used for?
>> ? path
USAGE:
    PATH value selector 

DESCRIPTION:
     Path selection.
     PATH is an action value.

ARGUMENTS:
     value -- (Type: any)
     selector -- (Type: any)
Rebolek
19-Jul-2007
[8516]
From RT Q&A:

Q: While reviewing the action! functions, I noticed the path action. 
The doc comment says "Path selection.". The parameters aren't typed. 
Does anyone know what this action does, and how to use it? Or whether 
it can be or should be called directly at all?


A: the PATH action is what the interpreter uses to evaluate VALUE/selector 
expressions for each datatype. It is an internal action and has no 
external purpose in programs. These kinds of words often appear as 
a sort of "side-effect" from how REBOL is structured.  Datatypes 
are implemented as a sort of object class, where the interpreter 
"sends messages" to the class to evaluate expressions. The PATH action 
is a message that tells the datatype to perform a pick-like or poke-like 
internal function.

Some other discussion:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/aga-display-posts.r?post=r3wp152x1804

http://www.rebol.org/cgi-bin/cgiwrap/rebol/aga-display-posts.r?post=r3wp157x7205
Geomol
19-Jul-2007
[8517]
Thanks!
Louis
22-Jul-2007
[8518x2]
s: "Hi engkau. Mengapa kaulari? Topikau ada di sini dan jaskau ada 
di sana."


In string s above, is there an easy way to replace (with "engkau" 
all instances of "kau" that are not preceeded by  " " (a space) or 
immediately followed by a letter?
In other words, I only want "kau" to be replace with "engkau" when 
"kau" is preceeded by a letter and followed by a space or puncuation 
mark.
Geomol
22-Jul-2007
[8520x3]
Do you want "engkau" to become "engengkau"?
One solution:


s: "Hi engkau. Mengapa kaulari? Topikau ada di sini dan jaskau ada 
di sana."
p: s

while [not none? p: find p "kau"] [either all [p/-1 <> " " find " 
,." p/4] [insert p "eng" p: skip p 6] [p: skip p 3]]
If you don't want "engkau" to become "engengkau", you can use:


while [not none? p: find p "kau"] [either all ["engkau" <> copy/part 
skip p -3 6 p/-1 <> " " find " ,." p/4] [insert p "eng" p: skip p 
6] [p: skip p 3]]
Louis
22-Jul-2007
[8523x3]
Geomol, thanks!  I'll do some testing and get back with you in a 
few hours.
I have to get some sleep first. :>)
Geomol, perfect! and simple. Many, many thanks! You have saved me 
a lot of time.
Geomol
23-Jul-2007
[8526]
:-) I'm glad to help!
btiffin
26-Jul-2007
[8527]
Is there a way to detect if a script is run from >> do %script.r 
 versus  $ rebol script.r  ??
I'd like to  either from-console [halt] [quit]
Geomol
26-Jul-2007
[8528]
Can't you check on some of the values in system/script ? Maybe system/script/header 
or system/script/args ?
btiffin
26-Jul-2007
[8529x2]
I was playing with those...but you tweaked a memory.  There was a 
weirdness in the DevCon presentation...it was system/options/script. 
 Thanks John.
Much nicer error abends now.
Anton
26-Jul-2007
[8531]
Perhaps system/console/history.
Volker
26-Jul-2007
[8532x2]
parent of system/script. each 'do adds a header there while the sub-script. 
none? system/script/parrent/parrent IIRC.
..while the sub-script  runs..
try probing system/script from the subscript to figure it out.
btiffin
26-Jul-2007
[8534]
I think it comes down to  system/options/script  This seems to only 
be set (at least in GNU/Linux land) when the shell $ rebol script.r 
is used to kick start.  I'm pretty sure I can use this for a reasonable 
bail test.   Regardless of how many do levels down,  system/options/script 
 is the original shell start script name (or none if do'ed)  This 
is reasonable right?  If the user starts from the shell, bail to 
the shell, starts from the console, bail to the console.
Volker
26-Jul-2007
[8535]
i thought you want to check if the do is from another script. you 
want from the console. then you are right.
btiffin
26-Jul-2007
[8536]
Thanks Volker, your advice will likely come in handy in the not too 
distant future.  :)
Geomol
27-Jul-2007
[8537x3]
Given a block with one element:
>> blk: [1]
== [1]
I move the blk pointer forward one position:
>> blk: next blk
== []
I then append one element:
>> append blk 1
== [1 1]

and the head of blk is shown, which is the behaviour of append. The 
address of blk is the same:
>> blk
== [1]
I now clear the whole block:
>> clear head blk
== []
and append yet another element to the now empty block:
>> append blk 1
== [1]
But blk now points to the tail of the block!
>> blk
== []

Shouldn't I see the element at the position of blk? I mean, blk should 
now point to the head of the block, right? I couldn't find this in 
RAMBO.
Funny thing is, that if I append yet another element:
>> append blk 2
== [1 2]
the blk pointer now point at element 2:
>> blk
== [2]

So blk had the position 2 all the time, even when the block was empty!?
How does R3 behave in this regard?
Rebolek
27-Jul-2007
[8540]
tried all steps in r3 and looks exactly same
Gregg
27-Jul-2007
[8541x2]
clear head blk
 doesn't reset 'blk to the head of the series. If you do:

blk: head blk
clear blk

you should get what you expect.
or "blk: clear head blk"
btiffin
27-Jul-2007
[8543]
Documentation question again.  Are rebols better described as "programmers" 
or "script writers"?  Target audience; new users (of the rebol.org 
script repository in particular)  And I'll take other suggestions.
PeterWood
27-Jul-2007
[8544]
Take a look at Gabriele's email signature......

Gabriele Santilli
Rebol Programmer
btiffin
27-Jul-2007
[8545]
Thanks Peter
Geomol
28-Jul-2007
[8546x2]
Is it the language, that specify, what you are? With REBOL I think, 
it's possible to be a script writer, a programmer, a developer, a 
designer, an inventor, a tester, etc.. Doesn't it depends on the 
task or job situation, where you use REBOL?

Like there are many different jobs, where you need good english (language) 
capabilities.
I normally call myself a system developer or just developer, because 
I do many different jobs with REBOL, and "developer" is a more generel 
term.
btiffin
28-Jul-2007
[8548]
This was in the context of explaining %inhide.r from the rebol.org 
library.  I used programmer.  As in This script helps ensure that 
REBOL programmers know how to hide password input.  It was aimed 
at rebols just starting out.  I usually use rebol to mean  REBOL 
coder but only when I'm chatting to those in the know.  I've tried 
but I can't get my head around the REBOLer expression.  :)
Geomol
28-Jul-2007
[8549]
I guess, the confusion come from back, when the term "script writer" 
popped up first, in the '70 or earlier. Script writers were the ones, 
who wrote scripts (e.g. shell scripts), which were typically small 
pieces of code to be run in the shell on large computers (mainframes). 
Those scripts did operating system maintenance and called programs. 
Programs were written in languages as C, COBOL, etc.. So you had 
a clear distinguish between a script writer and a programmer. What 
we do today with REBOL is more often the programmers job (I think), 
even if it's called a script language.
btiffin
28-Jul-2007
[8550x2]
John;  As part of the cool kids hacker culture, you can't call yourself 
elite, but you're L33t.   Or in REBOL speak; guru.   Another name 
that you can't really call yourself, without someone else tagging 
you first.  So there you go, your tagged.   Then again, maybe I'm 
not worthy...I do have my sights set on attaining Bogus status someday. 
 :)
Yep agree.  It's a blurred line now-a-days.  While I was watching 
a group of C++ programmers p#$$ away some 30 million dollars my poor 
little Tcl/Tk prototype just made them mad.  "Not engineered if it's 
scripted!!!"  :)  Oh well, the original Forth system is still in 
production and corporate will try to replace it with a engineered 
solution...usually started with CASE tool cloud diagrams.
Geomol
28-Jul-2007
[8552]
What is hidden in the term "engineered"? What do they mean, when 
they say "it's not engineered" or "need an engineered solution"?
Henrik
28-Jul-2007
[8553]
geomol, probably a different word in this context for "not invented 
here"
btiffin
28-Jul-2007
[8554]
Umm, I think it means they don't get a chance to overthink the problem. 
 Now to be honest, large projects do need a good work breakdown and 
management back end, but the coding usually ends up far too complicated 
to ever get off the ground (in my somewhat limited experience - I 
only watched them fail 5 times so far).  And polyFORTH keeps chugging 
along... and again in a little defense of corporate...they have very 
few L33t's that can handle poly.
Geomol
28-Jul-2007
[8555]
I think, you're ok with in general calling the authors of REBOL programs/scripts 
for "REBOL programmers" or "REBOL developers". In most cases it's 
more correct than the term "script writer", as I see it.