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

World: r4wp

[#Red] Red language group

Gregg
26-Mar-2013
[6660x3]
Can we use the ROUND doc strings from REBOL, since Ladislav and I 
wrote them outside of RT?
I know ROUND is TBD, and you probably want it native, or you could 
use the old mezz version.
Even though REBOL uses /dup for APPEND and INSERT, would /dupe be 
a better refinement name?
Kaj
26-Mar-2013
[6663x2]
Isn't that to fool someone?
Also, perhaps human-friendly instead of user-friendly?
Gregg
26-Mar-2013
[6665x2]
It can be, but it's also the standard abbreviation for duplicate.
I'll let Doc say if it's for humans for users.
DocKimbel
26-Mar-2013
[6667x5]
ROUND: a bit premature, we still don't have a float type in Red.
Or you mean doc-string: sure you can.
Forth and RPL (I've done a lot of code in RPL long time ago) use 
DUP as abbreviation for "duplicate".
I see no need to make arbitrary changes from Rebol unless we have 
something to gain.
(Bookmark it, you might throw at me that quote someday in the future 
after I make a purely subjective and arbitrary change from Rebol. 
;-))
Kaj
26-Mar-2013
[6672]
version.r seems to be missing from the repository
DocKimbel
26-Mar-2013
[6673]
https://github.com/dockimbel/Red/blob/master/version.r
Kaj
26-Mar-2013
[6674]
Sorry, it's probably missing from my build recipe
Gregg
27-Mar-2013
[6675]
Has anyone tried APPEND/DUP?

red>> s: copy ""
== ""
red>>
red>> append/dup s #" " 10
== 10
red>> s
== " "
red>> head s
== " "
PeterWood
27-Mar-2013
[6676x7]
red>> s: copy ""
== ""
red>> append/dup s #"1" 10
== "1111111111"
red>> length? s 
== 10
red>> s
== "1111111111"
There aren't any tests of refinements to append yet. I'll start an 
append-tests.red file for them inlcuding your 10 spaces test Gregg.
It appears that the problem is only appending spaces to a null string. 
it seems okay appending 10 spaces to a space.

red>> length? append/dup " " #" " 10
== 11
The issue seems to be with the console as the tests work in both 
the compiler and the interpreter.
The issue seems to be with the console as the tests work in both 
the compiler and the interpreter.
Sorry for the double posting.
Actually, Gregg's test works under OS X:

Schulz:Red peter$ ./console

-=== Red Console alpha version ===-
(only Latin-1 input supported)

red>> s: copy ""
== ""
red>> append/dup s #" " 10
== "          "
red>> length? s
== 10
sqlab
27-Mar-2013
[6683]
works under WinXP too
red>> append/dup s: copy "" #" " 10
== "          "
red>> length? s
== 10
red>>
DocKimbel
27-Mar-2013
[6684]
Works here from Win7 too.
Ladislav
27-Mar-2013
[6685x3]
'For MOLD/ALL, are you calling it "serialized" format in Red? And 
I assume that's a TBD at this point.' Gregg, suggested reading:

http://en.wikibooks.org/wiki/REBOL_Programming/mold
'No: without /ALL: "source" format, /ALL: "loadable" format?' - /ALL 
has a totally different meaning for LOAD than for MOLD, BTW
See also http://issue.cc/r3/1955
DocKimbel
27-Mar-2013
[6688]
Your "construction syntax" is a bit long but accurate and meaningful 
naming.
Ladislav
27-Mar-2013
[6689x3]
Not exactly mine (to not take credits for something I did not invent), 
but I am promoting it is meaningful.
err: "as meaningful"
copying:

http://issue.cc/r3/2006
DocKimbel
27-Mar-2013
[6692]
Saw it in R3 group. It's a nice trick, but don't you think that the 
setword used in such place might confuse readers? (at first look, 
I read [i: 100]...)
Ladislav
27-Mar-2013
[6693x2]
We shall se what the preferences are...
(At least I hope so)
DocKimbel
27-Mar-2013
[6695]
Using [i:] instead of i: would remove the possible confusion, but 
it looks a bit inelegant.
Pekr
27-Mar-2013
[6696]
Wouldn't it look confusing, if one would like (not sure anyone would 
to :-) to use something like:

 repeat i: j: 10 [print [i j]]
Ladislav
27-Mar-2013
[6697]
confusing? hmm, you can use parentheses to make it more readable:

repeat i: (j: 10) [...]

if you prefer
Pekr
27-Mar-2013
[6698]
that's right ... I would understand the code even without parentheses, 
I think ....
Gregg
27-Mar-2013
[6699x7]
Append/dup, thanks all for testing. Not sure how I could have broken 
anything by just adding doc strings to boot.red, but it's not just 
spaces for me here (Win7):

red>> s: copy ""
== ""
red>> append/dup s #"1" 10
== 10
red>> s
== "1"
red>> length? s
== 1
I will have to test more. If I just paste the original append source 
into the console (i.e. all doc strings removed), calling append then 
crashes.
If I rebuild the console with the version of append that has no doc 
strings, it works fine. Interesting.
It's having the doc string on the /dup refinement itself that causes 
it.
Take that out and it works fine.
It looks like that 's the case for all refinements that take an arg. 
If you have a doc string before the arg, it causes the arg to be 
ignored.
Can someone please confirm?
DocKimbel
27-Mar-2013
[6706]
Testing with a string! between a refinement and its argument, I get 
odd results (but no crashes so far). Definitely a bug.
Gregg
27-Mar-2013
[6707]
Do you want a bug report, or have you logged it yourself?
DocKimbel
27-Mar-2013
[6708]
We need a bugtracker entry for this one, if you're on it, please 
add it.
Gregg
27-Mar-2013
[6709]
red>> get 'x
red>> type? get 'x
==
red>> print type? get 'x
unset

The second result is the one in question.