• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[!REBOL3] General discussion about REBOL 3

Ladislav
30-Dec-2012
[378]
...we want to distinguish R2 to R3 scripts...

 - it depends. I found out it was much easier to maintain %include.r 
 running in both R2 and R3 than to have two separate versions needing 
 the same care twice.
BrianH
30-Dec-2012
[379x3]
I use .r for scripts that are expected to run in R2 or R3, .r2 for 
R2-only scripts and .r3 for R3-only scripts. However, a lot of my 
scripts are .cmd and call themselves with the appropriate Rebol.
In general, it is rare for me to use .r for scripts other than rebol.r, 
and I use the same one with R2 and R3.
I use .cmd instead of .bat because the tricks you use to call Rebol 
safely require cmd.exe (in NT-based Windows) and won't work with 
command.com (in Win9x/Me). It's not necessary to use .cmd for this, 
but it's a good reminder.
Robert
30-Dec-2012
[382]
.r = both
.r2 = R2 only
.r3 = R3 only
GrahamC
1-Jan-2013
[383x3]
Didn't help take you to a web page on www.rebol.com once?
Ahh, it's help/doc
Regarding 'read https://github.com/rebol/r3/blob/master/src/core/n-io.c

are lines 297-308 not used?
Robert
2-Jan-2013
[386]
How about a native to create temporary filenames? It's something 
I need quite often.
Andreas
2-Jan-2013
[387]
Yes, I would like that as well.


For a proper solutation that avoids race conditions, it should create 
temporary files, not file_names_, though. So that would probably 
require a temp:// scheme?
TomBon
2-Jan-2013
[388]
Or just use syscalls .The posix extension I am working on will provide 
these features, template based creation too. 
for windows you can use this api call.  


http://msdn.microsoft.com/en-us/library/windows/desktop/aa364991(v=vs.85).aspx

example:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa363875(v=vs.85).aspx
Andreas
2-Jan-2013
[389x2]
Of course you'd use syscalls to implement it. The scheme remark was 
about how to expose them in Rebol :)
Looking forward to your POSIX extension. Besides tempfiles I'd also 
regularly need support for working with symlinks.
Maxim
2-Jan-2013
[391]
using a scheme is a good idea.  then we can add various options to 
how to build them including things like auto naming, manual naming, 
prefixed naming, numbered, and the way it reports if a tmp file already 
exists.
BrianH
2-Jan-2013
[392]
Definitely sounds like a job for an extension.
TomBon
2-Jan-2013
[393]
yes link, unlink and lstat are included too.
Andreas
2-Jan-2013
[394]
readlink(3P) would be nice as well.
TomBon
2-Jan-2013
[395]
ok, will include this and CPU_SET ;-)
Andreas
2-Jan-2013
[396]
heh, CPU_SET will make this highly linux-specific, though. scheduling 
this externally with taskset(1) doesn't fit your needs?
TomBon
2-Jan-2013
[397x4]
there are ~450 functions in total. many of them are redundant but 
I guess I will hit ~150. it's more diligent work because it's just 
a thin wrapper.
yes, but this extension will be the foundation of  a nix/serverbased 
rebol.
controlling hardware resources will be very important here. just 
a quick fork, setaffinties, done. (so far in theory) ;-)
btw, andreas any plans for a tokyo/kyoto extension? if so, I could 
strike this from my todo list otherwise I would start after posix. 
(asking just to avoid double work)
Andreas
2-Jan-2013
[401x3]
Not at the moment, no.
LevelDB, if anything. But I don't expect to get to that any time 
soon.
After the current build streamlining work, I plan to look into better 
stdio and a more versatile "call" next.
BrianH
2-Jan-2013
[404]
Still should be an extension though, since not everyone is running 
R3 on a server. And definitely if it is limited to server platforms, 
or any platform limits.
TomBon
2-Jan-2013
[405]
yes, call is migthy when proper designed. using os.execute and io.popen 
all the times with lua. highly underestimated for it's capabillities 
but not easy to built.
Andreas
2-Jan-2013
[406]
yeah, is use that all the times as well :)
TomBon
2-Jan-2013
[407x2]
would be VERY valuable if you could make call better.
Brian, the posix extension is also to refresh my lost C skills (heck, 
I lost half of rebol in only 6 month I was buys with Lua) and I have 
no claim this extension need to run everywhere nor do I want to pollute 
the rebol way. it's just a component to fill some gaps for serverbased 
processing on linux machines.
Maxim
2-Jan-2013
[409]
once released, we can definitely look at making it multi-platform, 
 as much as possible.
PeterWood
4-Jan-2013
[410x2]
Is this a bug in R3?

>> mi: #00000002
== #00000002

>> save %mi.txt mi

** Script error: encode does not allow issue! for its data argument
** Where: if save
** Near: if lib/all [
    not header
    any [file? where url? where]...
Also should load not recognise the literal form of issue!:

In REBOL 2:
>> my-issue: #00000001
== #00000001
>> save %mi.txt my-issue

then in R3:

>> my-issue: load %mi.txt
== "#00000001"

>> type? my-issue
== string!
Maxim
5-Jan-2013
[412]
looks like a bug to me
BrianH
5-Jan-2013
[413]
>> file-type? %mi.txt
== text
>> file-type? %mi.r
== none


Text is considered a file type in R3, like .jpg and such. I think 
it was intentional, though I'm not sure whether we should continue 
to intend this. We should check with Carl.
GrahamC
9-Jan-2013
[414x2]
Anyone know how to use PUT in http?  And how to use write ?
This does a post

to-string write http://www.rebol.net/cgi-bin/r3-echo.r"trest"
Gabriele
9-Jan-2013
[416]
http://www.rebol.net/wiki/Scheme:_HTTP
GrahamC
9-Jan-2013
[417x11]
ah .. figured it out from reading the source :)
Amazon now insists that soap requests use https so back to using 
their REST protocol
>> write http://www.rebol.com/index.html[ HEAD ]
== [%/index.html 7407 none]
Shouldn't I get more information than this back?
since this is the trace

HEAD /index.html HTTP/1.0
Accept: */*
Accept-Charset: utf-8
Host: www.rebol.com
User-Agent: REBOL

HTTP/1.1 200 OK
Date: Wed, 09 Jan 2013 09:03:18 GMT
Server: Apache
Last-Modified: Sat, 15 Dec 2012 07:02:21 GMT
Accept-Ranges: bytes
Content-Type: text/html
Via: 1.1 BC5-ACLD
Content-Length: 7407
Connection: close
There is a bug here


  if headers/last-modified [info/date: attempt [to date! headers/last-modified]]
>> write http://www.rebol.com/index.html[ HEAD ]
make object! [
    name: none
    size: none
    date: none
    type: 'file
    response-line: "HTTP/1.1 200 OK"
    response-parsed: none
    headers: make object! [
        Content-Length: "7407"
        Transfer-Encoding: none
        Last-Modified: "Sat, 15 Dec 2012 07:02:21 GMT"
        Date: "Wed, 09 Jan 2013 09:24:53 GMT"
        Server: "Apache"
        Accept-Ranges: "bytes"
        Content-Type: "text/html"
        Via: "1.1 BC5-ACLD"
        Connection: "close"
    ]
]
But to-date will not work with "Sat, 15 Dec 2012 07:02:21 GMT" so 
info/date gets set to none
There's likely the same bug in 'query wherever that is defined
digit: charset [ #"0" - #"9" ]
alpha: charset [ #"a" - #"z" #"A" - #"Z" ]
idate-to-date: func [ date [string!] /local day month year zone]
[

 either parse date [ 5 skip copy day 2 digit space copy month 3 alpha 
 space copy year 4 digit space copy time to space space copy zone 
 to end ][
		if zone = "GMT" [ zone: copy "+0" ]
		to date! rejoin [ day "-" month "-" year "/" time zone ]
	][ none ]
]


if headers/last-modified [info/date: attempt [ idate-to-date headers/last-modified] 
]
		
seems to work
Hmm.  Will this fail if your locale is not english, and the web server 
is giving dates in enlish?