« first day (825 days earlier)      last day (2955 days later) » 

dt2
12:00 AM
Hw does the code via paren look?
could the red-parse be portet to rebol?
 
I just cited the two lexers a few hours ago which shows two implementations...but not two formalisms. I think Rebol could use some kind of generator to make the C code that would be a bit less accident prone.
And the spec could be encoded in a Rebol formatted file, but having this spec "be the parse dialect" is probably the wrong fit.
 
dt2
wait, red has its parser written in rebol. and you portet it to r3.
 
@dt2 Yep.
 
dt2
so to start we could use that
for tests and slowly eliminate the differences
 
It's a better starting point than C code, yes, but I think an even better starting point is very traditional compiler/parser logic where you work in something less "imperative" and even more "declarative" which can be analyzed for inconsistencies from the get-go
And Chris has already gotten started with this, sounded like earl has too, so I think it's just a matter of getting everyone to agree that getting on the same page with an ISO/IEC style standard for Rebol data exchange is a good thing.
 
dt2
12:08 AM
also, you wrote about something, forgot the name. basically you share the loaded form and have multiple text representations.
 
@dt2 Hmm? Don't know what you mean. But I did say that UTF-8 is a fine standard for encoding at the LOAD/MOLD exchange level. It may be more efficient to make other assumptions once the implementation has strings in memory, but for interchange I see no reason to use anything else.
 
dt2
i think the trick with rebol is that is is not declarative, but interprets dialects at runtime. declarative may work better, but it is not, hum, crazy enough.
 
Boring old parsing and compiler theory has its place. :-)
 
dt2
But parse does nearly the same, and is rebolish! :-)
 
@dt2 Nearly, but not close enough to stop edge cases that generate bugs and paradoxes, it is a better implementation tool for that sort of thing than C but it's just not specification quality.
 
dt2
12:12 AM
But a real compiler-compiler can find some ambiguities AFAIK.
Same thought same time. :)
So we need a compiler from parse-subset to coco
and both are happy
 
It would be nice for one canonical spec to build out to C and Rebol parse. Rebol would then use the C one for efficiency and stability of bootstrap. Red and various Rebol projects would use the Rebol parse one.
This is not unattainable, the hard part is getting everyone on the same page and saying that this family of projects cannot live by the idea that they have different definitions of what's a legal word!... or date! literal... the very idea that there would be an incompatibility has to be seen as bad and we stomp that out
 
dt2
But the spec does not need to look like Values ::= WhiteSpace? ( Value ( WhiteSpace? Value )* )? WhiteSpace?
that could look more rebol-like. and then it looks close to parse
if cocos want it like this, it can be build from it.
 
@dt2 It can look like anything but the key is avoiding paren or other "escapes" into open code for pattern analysis
Do feel free to do a compiler-compiler prototype that builds a more correct, and as-fast-or-faster implementation of l-scan.c for Rebol. Once you have, the parse implementation for Red will be a cakewalk. :-)
 
dt2
intuitively i think rebols-parse does not need parens. they are for doing something with the parsed stuff, not for changing the parsing. Need to see a case where this is needed. You mentioned reds parser needs, reding a bit.
 
I just want everyone agreeing that such a thing is important to do. Practically every other language has done this, and because Rebol hasn't you have that big "WARNING WARNING" and issues like the wacko tag select bug.
And agreeing that at least on this part, Red and Rebol have a lot to gain from a standard.
 
dt2
12:25 AM
Yes, i hope parse without parens can do that.
And also be compiled to rules for other cocos.
 
@dt2 Parse without parens still has some very imperative mechanisms that become hard to analyze with formal methods.
 
dt2
Do not use them. Would that work?
Or, have a rebol-dialect which compiles to parse and cocos.
 
I think the issue is that if you pull out all the powerful things in parse, the looping and the setting and getting of positions...and whittle it down to a trivial set of operations, you've lost the power and it's no longer expressive enough to meaningfully encode Rebol's lexical analysis.
It wasn't designed to have its hands tied in that way, so it's not the place to look for inspiration for this class of problem.
Can be a Rebol dialect inspired by other things, just won't be parse!
 
dt2
It must only handle rebol. the other things are for other peoples grammars.
 
@dt2 True but unless you can really say why the things they're worried about are things Rebol does not have to worry about, it's hard to know what to get rid of. (Like Mozart's response to the "too many notes" critique in Amadeus..."um, which notes do you suggest I leave out, your highness?")
 
dt2
12:32 AM
it must have deal with edges likeif "<" is a tag or not. maybe sometimes some lookahead. is there a list of such problems? i always thought i could do it with some regex for the tokens.
if i can compile my dialect to their spec, and it works, would that help?
 
I'm a terrible person to ask about this because parsing is actually antithetical to most of my (prior, at least) beliefs about programming. Parsing always seems like an attempt to recapture intention out of a symbolic flattening that should never have happened...it's like handwriting recognition (why didn't you just type to begin with!)
There would be no unmatched braces, if braces were mere rendering artifacts of something your tool understood as a "block", for instance.
There would be only unparsing in such a world, not parsing...
 
dt2
No, have a look at colorizer. It knows about parens and spaces carries everything else to uncle load/next
 
I do suggest that if this topic interests you, that you speak with @rgchris.
 
dt2
and that could be done with a regex. needs some lookahead, hecause word: is a word, but word:url is not. which is trickier with parse.
 
I've only laid out the map of the territory but I'm not currently that involved with it besides knowing which source files are doing the work in both Rebol and Red.
Chris has done the textmate syntax highlighting also, so he's seen some of the edge cases.
 
dt2
12:38 AM
you gave me good enoug starting points to be interested. hope i am as smart when the problems show up, as i feel me now. :)
 
@dt2 Glad to hear it. :-) But yes, if you have a carryaway here, I hope part of it is "Rebol and Red can (and should) agree on this"!!
There's nothing to gain from not agreeing and a lot to lose.
In any case, time for dinner, be back in a bit...
 
dt2
Would start with reds lexer, so there is hope. Enjoy your meal!
Reminder to myself: ask later about projectional editing. would it be possible to have multiple textforms, but rebol and red share the same properties in memory. So load/red save/rebol would always work, even if one adds special grammar (hex or something).
and ask how hard it is to start with forks r3-read. i hope i can unzip something and see something happen, to get motivated. :)
 
 
3 hours later…
4:10 AM
Why does everything always take longer than you think it will...even when you take knowing that it will take longer than you think into account?
 
dt2
you forgot to add the time for thinking how long it will take?
 
Hello @KK. ... welcome to the Rebol water cooler. All topics are fair game, including "hey, what's Rebol?" :-)
A perfectly respectable thing to ask.
Or the latest Depeche Mode single. Really, it's all fine if no one else is talking about Rebol.
 
dt2
@fork, what would you use to do this verification magic?
 
You are referring to checking for edge cases in the lexing and parsing, vs. open code?
 
dt2
yes.
 
KK.
4:25 AM
Hello @HostileFork
 
I'd probably defer to earl and rgchris to figure it out. :-) But I'd crack open the textbooks probably and make sure I understood what family of grammar I was looking at and what kind of state machines were suitable or unsuitable.
@KK. Hello! Note that if you hover over chat messages in SO chat there is a little triangle that appears on the left. If you click on it you have the option to edit for 2 minutes.
 
KK.
@HostileFork thanks
 
You can also reply to a specific message by clicking the "reply" icon in the lower right when you hover over someone else's message. (Sorry I haven't gotten around to fleshing out this part of the FAQ, I only made it yesterday, but it's a wiki so I'm not the only one to blame. :-P)
@KK. Have you ever heard of Rebol before?
 
KK.
No.
I just saw the title "Rebol-and-red"
and came
 
Well, we are in a recruiting mode these days, so good! :-)
 
KK.
4:28 AM
Can you tell me something about it? If you are free.
 
I don't know how old you are, but have you heard of the Amiga?
 
KK.
No.
I will be 23 in April
 
Ah, okay. I'm 39.
The Amiga is from some computer stuff that was going on a while ago, back when the computing landscape was much different.
 
KK.
Ok.
 
And it had a bit of a cult following because it was better in a lot of ways than the competition at the time in terms of the operating system design and hardware. But it didn't have the momentum that the PC movement had, so it lost.
Anyway, Rebol is a computer language that has gained favor with a lot of people who were followers of that movement, as one of the Amiga Operating System designers came up with it.
That's not really a reason to use it, I'm just trying to tell you who the people tend to be and how old they tend to be :-)
 
KK.
4:31 AM
Is amiga the same OS that Guido .v Rossum was working on?
 
But hopefully this is up for change.
@KK. That looks to be "Amoeba". So nope. :-)
One of the things that has really made people like Rebol is that it's a "rebellion against complexity"
 
KK.
Ok.
 
Do you use any languages that have the "two kinds of quotes" for strings...like single and double?
So 'foo' is a string and so is "foo"?
 
KK.
Python, it has 3 kinds of quotes.
'foo' and "foo" are strings, and so are """foo""" and '''foo'''
 
Okay, now I don't want to act like this one little detail speaks for the whole language, but it speaks for being willing to look at things from ground zero and not do things the way other languages have just because...
...but in Rebol there are quoted strings like "foo" and there are braced strings like {foo}.
So I can make a string constant like {"It's nice when you have asymmetric string delimiters," said {Fork} in StackOverflow chat.}
As long as your inner delimiters are matched, you don't have to escape.
In other "every detail counts" aspects, the choice to use square brackets [ and ] as the main begin/end delimiters for code blocks was driven by not having to push shift to get them, as they are unshifted on most every keyboard layout.
These are tiny, tiny details but it's the sum of a lot of tiny details and rethinking of what is essentially a LISP family language. LISP was not...ergonomic.
LISP is actually nigh unreadable. CAR? CDR? (((()()()()())(())()))))
LISP (and Rebol) are based on the idea of "metacircular evaluation"
 
KK.
4:39 AM
I had about a week of Lisp work at college in 2010, and have read a lot about it from Steve Yegge's blogs.
@HostileFork I am a hobby developer. And by hobby I mean once in a few days. I just left my programming job and am learning a bit of python now a days. The problem is that I do not have any friends or acquaintances who know it so I am more like hitting my head on walls. I am willing to take up Rebol if you can guide me.
 
@KK. Well StackOverflow is a good resource for any Q&A...there's several of us here and we actually probably are more rabid about answering questions and doing your work for you than other more well known language users would be. :-)
 
KK.
Yes, thats why I thought of asking you directly for guidance.
 
The main warnings I'd give are that Rebol is a "fringe" language so it really is best suited to hobbyists.
 
KK.
So, for now, can you tell me from where I start with Rebol?
 
for now. But it became open source in December and we're hoping that will help drive it out of the shadows. Its proprietary nature killed it for most people.
@KK. This is a good question. Well, first things first is to get an interpreter. @earl here has made a build page of the open source version: rebolsource.net
The homepage Rebol.com is from the company that made it and abandoned it for two years, so you will find it rather outdated. We're trying to pick up some of the slack.
 
KK.
4:44 AM
Also, can you tell me if I should prefer using Windows or Linux(Ubuntu) for Rebol?
 
I prefer using Linux for everything I can. But it shouldn't make a big difference.
 
KK.
I was surprised at the home page.
It is old indeed.
 
Yes, we know.
Hopefully you like the new icon. :-)
(If not that's alright, I can handle criticism, but...)
 
KK.
I like it by instinct. Could you tell me if it means something special?
 
It refers to the choice of brackets in Rebol to denote series. I've written up some of the rationale here: rebol.net/wiki/REBOL_logo
So in other "unfinished wikis that might be good places to start", I'm not happy that this is old but it might help: rebol.net/wiki/Interactive_tutorial_script
@KK. Note that although I think the download page should mention it, @earl thought it was a little insulting of people's intelligence to mention you had to chmod +x the unix downloads...
 
KK.
4:51 AM
I just downloaded the windows binary.
No, I think it is good to mention the chmod+x , because IMHO not mentioning it will drive away noobs like me.
 
Okay, so fair warning. They say there's a curse in Chinese which is "may you live in interesting times". These are especially interesting times for Rebol. Which has gotten some of us all atwitter hanging out in programming chat rooms after years away.
Now that you have your interpreter up, let's try a couple of things. What do you get with first [apple banana orange]
 
@HostileFork I'd think those who use it would disagree. It's really a secret weapon :)
 
KK.
@HostileFork == [apple banana orange]
 
@GrahamChiu It's an atomic bomb that leaks plutonium all over yourself
@KK. You must have not seen first as being part of the code. :-) Which teaches something interesting.
 
KK.
Yes.
 
4:56 AM
Okay, so I don't know if you've done Ruby or not, but Rebol is the same way in that expressions are evaluated and then the last expression in a block is the value of that block.
So there doesn't need to be a return statement in a function. A function's value is just whatever the last statement returned. And that applies to all expressions.
 
KK.
No, I have not tried Ruby.
Ok.
 
If you only typed [apple banana orange] then you had an expression with one value, of type block! (datatypes end in exclamation points).
And the evaluator just said "hey, this is the last expression you typed in"
 
KK.
Ok.
 
So if you said print "Hello" (2 + 2) what does it do?
 
KK.
== 4
 
4:58 AM
I hope it also printed hello somewhere in there. :-)
 
KK.
Ok. So the hello was ignored since the value of the statement was the last thing
No, only == 4
 
>> print "Hello" (2 + 2)
Hello
== 4
That didn't happen? :-/
 
KK.
No. Let me take a snapshot and paste here.
Is it too small? Should I do it again?
 
missed the PRINT
 
KK.
I am on windows7, btw.
Just a sec.
 
5:02 AM
@KK. You're missing the print (print is not implicit). So your analysis was correct. It ignored the "Hello" (a string) and then evaluated to (2 + 2)
 
KK.
Try clicking on the image.
 
@KK. I can read it, no problem
 
@KK. You can right click on the console icon, select edit and then mark, and use your mouse to mark the text you want to copy, and then hit enter. It captures to your clipboard
 
KK.
Ok.
 
This is a primitive console that is temporary. We had a much better one for windows before in Rebol 2.
 
KK.
5:04 AM
@GrahamChiu I did not understand your last post.
About right clicking on the console icon...
Ok. I did it, and it worked.
@GrahamChiu thanks. :-)
 
@KK. Just if you wanted to copy and paste so as not to retype, I think. But it's okay to retype. We understand why it didn't work is because you did not letter-for-letter type in print "Hello" (2 + 2) perhaps because StackOverflow chat doesn't differentiate fixed width well enough, and "print" and "first" sounds like "okay, first do this..." :-)
 
KK.
Yes. I am sorry. I should have at least looked properly.
 
No problem. Okay, this is kind of basic, no surprises yet right
 
KK.
Now it printed properly
 
Now let's throw in a curve ball. Instead, try code: [print "Hello" (2 + 2)]
 
KK.
5:09 AM
>> code:[print "Hello" (2 + 2)]
== [print "Hello" (2 + 2)]
 
Nice. Okay, now do code
 
KK.
this time i am clueless
aah
 
type in

do code
 
It saved that structure--the structure that is your program--into a variable.
 
KK.
>> do code
Hello
== 4
 
5:10 AM
Now let's have some fun with it. replace code "Hello" "Goodbye"
 
>> replace code "hello" "goodbye"
 
KK.
Just a sec. Can I write anything instead of code. For example this worked:
>> karunesh:[print "Hello, I am Karunesh"]
== [print "Hello, I am Karunesh"]
>> replace code "hello" "goodbye"
== [print "goodbye" (2 + 2)]
 
Within the legalities of Rebol. Rebol is in some ways kind of strict, and in some ways very loose.
 
KK.
Ok.
 
One thing it's a bit of a stickler about is spaces.
If you really think about it, languages like JavaScript kind of shoot themselves in the foot for the lack of requiring spaces. You ever try to do CSS stuff like background-color in JavaScript, and you're forced to use a string when for the other CSS things you aren't...because it thinks you're trying to subtract color from background?
To Rebol, it's very different to write background - color and background-color. One of those is "three words" and the other is only "one word"
 
KK.
5:14 AM
Ok.
 
So we've changed the code, but let's "reflect it". Try first code
 
KK.
>> first code
== print
 
Now try type? first code (you will find type? very helpful...)
 
KK.
>> type? first code
== word!
 
You will notice that Rebol is a chain of processing where everything knows how many parameters it takes. So you don't need parentheses. That's just interpreted as type? (first (code))...this can be seen as maddening by people who expect computer languages to not work that way, but when we write our written human languages we infer the structure.
Okay, now type? second code and type? third code
 
KK.
5:19 AM
So, type? tells the type of something
what was print in code: [print "Hello" (2 + 2)]
 
word!
 
KK.
is word! like a string in other languages?
 
@KK. Yes, when it's being used. Something you may notice is that there's a big difference in Rebol between using something and just mentioning it. The symbols don't have meaning until they are given it.
@KK. It's rather different.
 
KK.
Ok.
 
Rebol does have strings, and in fact the type of the second element in that series of code is an actual Rebol string!.
 
KK.
5:21 AM
Ok.
 
You would see that with type? second code
 
KK.
Yes. I saw it.
 
And eerily enough, if you say type? third code it will tell you paren!
 
KK.
Yes, it did
 
By that it doesn't mean that the parentheses (left and right) are elements in the code
It means the whole parenthesized series (encompassed by the beginning and end parentheses) is a sub-series.
In fact, check this out
second third code
 
KK.
5:23 AM
>> second third code
== +
 
So the third element in your series of code is a parenthesized block, itself a symbolic series.
And the second element in that third series is a word, the word for "+"
This is LISP-y
 
KK.
Ok.
I think I see the lisp-iness here
 
But unlike LISP, you've got lots of parts in your parts bin. And you can make them do whatever you want.
 
KK.
Ok.
 
You don't just have one kind of symbol series... you have many. And you can give them all different behaviors.
Let's show you something kinda mindblowing
 
KK.
5:25 AM
Ok.
 
The baseline interpreter... the one that we've been using to print and all of that, is running what we call "the DO dialect". It's what happens when you DO a block of code, as you've seen. But it's also the default for what happens at the command line or when you run a script file.
 
KK.
Ok.
 
Any time you take these symbol types and ascribe your own meaning to them, we call that a "dialect"
Plus doesn't have to mean plus, parentheses don't have to be used for precedence...when it's your dialect, it's your rules.
 
KK.
Ok.
 
One of the neatest one that comes in the box is called the PARSE dialect. Try parse "aaabb" [3 "a" 2 "b"]
 
KK.
5:30 AM
>> parse "aaabb" [3 "a" 2 "b"]
== true
 
And remember whenever you are typing that Rebol is super picky about spaces. 3"a" is not the same as 3 "a". The one place you get slack is around brackets and parentheses.
 
KK.
Is the PARSE dialect like regex?
Yes.
 
@KK. It's like it, except it doesn't suck. In fact, it's rather ingenious.
 
KK.
:)
 
What you saw happen there was that the first thing is the series you wanted to parse, and the second was a block which is a dialect. It returned true because the rules of the dialect showed that it matched the input...which is to say, following the patterns it reached the end of the input based on those rules.
Had it not reached the end of the input you would have gotten a "false" back.
For instance parse "aaabb" [3 "a" 3 "b"] would be false. Because there weren't 3 "b"s.
 
KK.
5:33 AM
Yes, I tried it and it was false
 
But now let's play with power... try this on for size: parse "aaabb" [3 "a" (print "Foo") 3 "b" (print "Bar")]
 
KK.
Ok. So it printed Foo since there were actually 3 a's, but did not print Bar since there were only 2 b's
>> parse "aaabb" [3 "a" (print "Foo") 3 "b" (print "Bar")]
Foo
== false
 
Yes, but here's the point I am trying to make... notice the choice that the parse dialect makes on what parentheses mean.
It has nothing to do with precedence.
 
KK.
Yes.
 
The parse dialect just got whimsical and said "hey, should a parenthesized series of stuff show up...I'll treat it this way: whatever's inside, it's code I'll run if I actually reach that point in the match rule.
But this is not magic that only the implementers of Rebol have in their hands, it's the kind of decision you could make.
And we've only dipped our toes into the pool of what you have available.
 
KK.
5:37 AM
So different dialetcs can have different ways of making choices?
Aah.
 
They have type? available to them, they can look at the code. They can also invoke DO and PARSE if it suits them to implement a subset of their function.
Or delegate to any other dialect.
And the types are rather amazing. Try this on for size: type? <a href="http://hostilefork.com">
 
KK.
>> type? <a href="http://hostilefork.com">
== tag!
 
Most languages would be like "uh, is a less than type? That doesn't make sense..." :-)
How about type? http://stackoverflow.com
 
KK.
Just a sec
>> type? http://stackoverflow.com
== url!
 
I know the http is in there, we get the gist :-)
How about type? brian@hostilefork.com ?
 
KK.
5:40 AM
Ok. Yes.
its an email
 
So if the type? function is available to a dialect implementer...
You can really build your own language with these nice, very readable parts.
 
KK.
Ok.
 
It's really nothing you couldn't have done with LISP except LISP was so homogenous that it reduced everything to computational dust. Everything was parentheses, strings, symbol... that's it.
Rebol stuff can look as nice as you choose to make it.
 
KK.
Ok.
 
I think it's important to remember that a lot of people mix up the DO dialect as being Rebol itself, when it is only a dialect.
 
KK.
5:43 AM
Ok.
 
And some people think PARSE is a Rebol feature as if you couldn't have written it yourself, when you could have (although it would be slower, as the current implementation is part of the C code internals).
 
KK.
Ok.
 
But in a lot of ways, Rebol is just a better XML. The guy who invented JSON saw Rebol and was very excited about it many years ago, and went off and tried to use some of the concepts to make JSON which is now very popular and replacing XML in many settings.
But here's something to try. protect code
 
KK.
Yes, I too saw the quote somewhere a few minutes back.
>> protect code
== [print "goodbye" (2 + 2)]
 
Now replace code "goodbye" "hack"
 
KK.
5:46 AM
So, protect code simply got us code as it was when we typed it?
Just a sec
Ok. Nothing in protected code can be replaced.
 
Bear in mind that every function has to return something, even if that something is nothing... :-) So to try and make it easy to pipeline commands, Rebol will often return one of its inputs if it doesn't have an obvious "thing to return" that isn't one of its inputs.
Other languages pull that kind of thing too.
 
KK.
Ok.
 
In fact, Rebol programmers are rather notorious for stringing together things in a line with all the casualness of writing English, and this is a horrible habit for newbies to be able to read.
 
KK.
Python returns None in such cases, but how can one of the inputs for a function be returned?
haha
 
Because the DO dialect chooses to use paren! groups for precedence, it is possible to call out parameters to functions.
You can return an input either by value or by reference... but usually by reference in Rebol because it's "cheap" and doesn't like to make copies. You have to copy things explicitly a lot where other languages would make copies, in fact, using copy.
 
KK.
5:50 AM
Ok.
 
People get on my case when I put parentheses in things, and one of the reasons is that another dialect Rebol people love is called COMPOSE.
It's a templating system for Rebol code and data.
And what it does is it takes a block of symbols and lexical elements and leaves all of it alone... except for those things in parentheses.
If something is in parentheses, it is evaluated. So try new-code: compose [print (reverse "Hello")]
 
KK.
>> new-code: compose[print (reverse "Hello")]
== [print "olleH"]
 
It didn't run print. But it ran reverse! It only runs the code in parentheses, everything else is left intact.
 
KK.
Ok.
 
So if you have a big block of code that you want to use as a template in this fashion, if you've been using parentheses in it to call out precedence or unnecessarily show a newbie what parameters are going to what functions... you run into trouble. So people learn to write their code without parentheses for precedence.
Which results in some fairly cryptic looking stuff :-)
It's a bit of an achilles heel in a way that Rebol kind of expects you, the reader, to know how many arguments a function takes in order to mentally read a line of code.
But I say "Rebol" when I really mean to say "DO dialect of Rebol". It's something you may embrace or reject, based on your situation. If you want to force everyone to use blocks and parentheses you can.
 
KK.
5:58 AM
I was going through some question about learning Haskell, and one of the answerers wrote something about un-learning or simply forgetting about procedural/OOP languages while learning it. I think Rebol is similar in this sense.
 
Haskell and the other pure functional languages are quite different themselves, the way I've adopted to say it (stolen from somewhere on the 'net) was that they have an academic axe to grind about making computer systems more formalized and eliminating multithreading bugs by introducing great rigor.
 

« first day (825 days earlier)      last day (2955 days later) »