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

World: r3wp

[!REBOL3]

Maxim
21-Sep-2010
[4992]
yeah, ok, so its not a map thing... that is now obvious, since the 
select doesn't evaluate it..
BrianH
21-Sep-2010
[4993]
Welcome to the wonderful side effects of increased language consistency 
:)
Maxim
21-Sep-2010
[4994x2]
I like the fact that you are modularizing LOAD... I did try to modify 
it before and well... I thought you where brave of even getting it 
to work at that point  :-)
I had forgotten about get paths... thanks... that is what I need.
BrianH
21-Sep-2010
[4996]
Carl requested the modularization. And I definitely wanted to do 
it because the whole module and script system didn't pass the hit-by-a-bus 
requirement.
Maxim
21-Sep-2010
[4997]
hehe... I agree  ;-)
Andreas
21-Sep-2010
[4998]
I can't help but wonder if we'll ever get maps that are meant to 
be used like maps ...
Maxim
21-Sep-2010
[4999x2]
actually the cultprit is the path walking here... but I agree that 
using them as objects within path notation is strange.
brianH can you tell me *why* path notation evaluates map lookups?
Andreas
21-Sep-2010
[5001]
(I have no gripe with the path notation. It's the old strict-equal? 
issue the above was hinting at.)
Maxim
21-Sep-2010
[5002x2]
brianH  " increased language consistency" if this where true, then 
we couldn't store object in blocks without evaluating them by default 
either. 


IMHO maps are just hash tables, just like a block.... storage, not 
vector jump tables.   but that might just me my skewed view of the 
world.
oops... sorry my last statement was a bit messed up... ignore the 
first line...
Andreas
21-Sep-2010
[5004x3]
Well, it sure _is_ more consistent to always have paths which ultimately 
refer to a function! make the function an "active" value.
Wether that consistency is desirable or worth anything is on another 
page.
But it generally simplifies things if you don't have to re-define 
the semantics of all path variations.
Maxim
21-Sep-2010
[5007]
anyways, we do have get paths now... so I guess I'll just shut up 
and stop stirring air  ;-)
Andreas
21-Sep-2010
[5008]
Yeah, and that illustrates the consistency argument: if paths with 
a map! as underlying would be redefined to behave like get-paths 
per default, what should get-paths on maps do :) ?
Maxim
21-Sep-2010
[5009]
shave my neighbor's unclean dog?  ;-P
Andreas
21-Sep-2010
[5010]
I'm more for making coffee, but that's not too bad an idea either 
:)
Ladislav
22-Sep-2010
[5011x2]
Hi, I corrected http://www.fm.tul.cz/~ladislav/rebol/evaluate.r(I 
omitted a USE-RULE call for the last rule in the script), and renamed 
the accumulator 'a in accordance with industry standards.


Also, I added an efficiency note related to R3 protection disallowing 
us to use a simple binding method to create the USE-RULEs during 
function initialization (creation) instead of creating the USE-RULEs 
every time the respective function is called, which is inefficient.


I wonder, whether we should consider a way how to allow the creator 
of the function to perform some additional initialization during 
function creation.
As I demonstrated in the %use-rule.r script, such an initialization 
is possible using a method to circumvent the protection R3 uses, 
but it looks neither simple, nor very efficient.
Pekr
22-Sep-2010
[5013]
Some bugfixing for A108 - http://www.rebol.com/r3/changes.html
Ladislav
22-Sep-2010
[5014x5]
This is probably the least "cryptic" way how to be able to initialize 
functions:

func-with-init: func [
	init [block!] {initialization code}
	spec [block!] {
		Help string (opt) followed by arg words 
		(and opt type and string)
	}
    body [block!] "The body block of the function"
] [
	spec: copy/deep spec
	body: copy/deep body
	insert body compose/only [
		if init? (init)
		init?: false
	]
	body: use [init?] reduce [
		first [init?:] true
		body
	]
    make function! copy/deep reduce [spec body]
]


>> fr: func-with-init [initialized: now] [] [print ["this function 
was initialized:" initialized]]
>> fr
this function was initialized: 22-Sep-2010/9:36:22+2:00
The initialization has to occur in the function body, unfortunately, 
otherwise the R3 protection does not allow BIND to be used, which, 
on the other hand, means, that the IF call is done every time the 
function is called, which means additional overhead
But, anyway, this solution looks less "cryptic" than the one used 
in the %use-rule.r script, I guess
Another disadvantage is, that for this version to work, the 'init? 
variable must not be an argument (local variable) of the new function.
http://www.fm.tul.cz/~ladislav/rebol/func-with-init.r
Maxim
22-Sep-2010
[5019]
A108 now uses  #  to represent none... neat!
Gregg
22-Sep-2010
[5020x2]
Thanks for doing the func-with-init research Ladislav. While I think 
we sometimes focus too much on optimization, I can see this as being 
important in the big picture for writing function generators that 
produce efficient results.
This version is not as cryptic, even though it's longer. I can understand 
it. :-)
Henrik
22-Sep-2010
[5022]
http://www.rebol.com/article/0487.html

Function splitting.
Pekr
22-Sep-2010
[5023]
bleeeah :-) REBOL as a messaging language has networking protocols 
being an optional package = no standard functionality over the REBOL 
installations. Great, what's removed by default next?
Andreas
22-Sep-2010
[5024x6]
Pekr, network protocols are still there and bundled within the binary.
So they still are "standard functionality over the REBOL installations".
It's just that you'll hvae to explicitly import them, if you need 
them.
Let's use DECODE-CGI as a simple example: currently in R2, you fire 
up R2 and can use decode-cgi in your code straight away.
Currently in R3, it's not there at all.
In the future in R3, the code itself will be bundled with R3, but 
if you fire up R3 and type decode-cgi, it won't be available straight 
away. You'll have to explicitly import the CGI functions with import 
'cgi first.
Pekr
22-Sep-2010
[5030]
do you use rebol without networking or db protocols? what for?
Andreas
22-Sep-2010
[5031x2]
Yes. Many different scenarios. I have never used REBOL's ftp protocol, 
for example.
And obviously there are many REBOL scripts which will never need 
the CGI stuff :)
Henrik
22-Sep-2010
[5033]
Pekr, I believe this is not just for distribution purposes, but for 
allowing R3 to start up faster in certain cases, not having to initialize 
various protocols, etc.
Andreas
22-Sep-2010
[5034]
And to reduce clutter in the "global" default namespace.
Gregg
22-Sep-2010
[5035]
The question is what tradeoffs are best? I have to say, even with 
Base available, I like having everything just work out of the box. 
How much does each exclusion save us? This is a tough call. Of course 
I want things lean and mean, but I also don't want every script I 
write to have 5 or 10 lines of import statements for what we've come 
to expect as standard functionality.


Do we have any kind of cross reference or dependency list? That is, 
do we know exactly what we're talking about?
Andreas
22-Sep-2010
[5036x2]
Gregg, same response to you: nothing will be excluded. Just not imported 
by default.
And you can do imports in the header, or on a single line.
Maxim
22-Sep-2010
[5038]
and the plus package is on by default, unless you switch it off on 
the command-line.  which is a good idea IMO.
Andreas
22-Sep-2010
[5039]
IMPORT with a block! as argument does the same as the NEEDS block 
in a header.
Gregg
22-Sep-2010
[5040]
Right, what I don't want is to have to explicitly import "basic functionality" 
in every script. The question is what is basic? And while we can 
certainly do it in a single header line, that's far from the same 
as having it "just work". 


I just want to make sure we're saving enough to make it worthwhile. 
You know how I hate premature optimization. ;-)
Andreas
22-Sep-2010
[5041]
That's precisely the point: what one considers "basic" functionality 
varies widely :)