« first day (2162 days earlier)      last day (1618 days later) » 

2:59 AM
@DaviddenHaring Kaj has been involved with Boron personally, which is why it's up there. Before Rebol was open-sourced and before Red, Boron was the available open-source choice for Rebol-like code, that Syllable (the OS he works on) used for its scripting. Note if you read the fine print, TryRebol itself is "powered by" SyllableOS...the server isn't running Linux.
 
 
3 hours later…
6:27 AM
@HostileFork I think that you are expecting that any expression X that evaluates to a number must mean that 1 + X (without parentheses) evaluates to that number plus one.
You wouldn't say that about X + 1, we all know that. So what's so special about 1 + X?
 
@MarkI Um...do you mean what's so special in an evaluator that starts from the left and processes to the right...about left and right?
We could make it start from the right and process to the left if you wanted. But I imagine that would make people more upset as a deviation from classic Rebol.
 
You are making infix expressions go from right to left, not me!
So you are saying because it is a left-to-right language, no left context should ever be reduced.
 
As my examples show, I've formalized what really powers "infix" behavior... which is "lookahead" and its complementary aspect of "lookback".
Which is what it was before; no shifting, no reducing, none of that. It was just lookahead with a kind of weird rule that prevented lookahead.
 
If you cannot call the infix behaviour prioritizing reduction over shifting then I give up.
 
@MarkI Are you absolutely certain you know how R3-Alpha's infix worked :-/
 
6:33 AM
@HostileFork Yes, and what you are saying is that that rule is too complex, and you are willing to reverse infix processing to fix that.
@HostileFork I have mentioned that thinking about multi-variate versions is counterproductive to this issue, so, as far as binary operators go, yes, I am absolutely certain that R3-Alpha's infix prioritizes reduction over shifting.
 
New users of Rebol have criticized it for not doing "mathematical precedence" and they might react by saying "oh, because you think the rule is too complex, you won't do what the users want!"
And so Rebol programmers calmly explain that having simpler rules help empower a more general and composable engine...that it has niftier features that way if you take a longer term view.
 
Hahaha. You can't have it both ways. Well, maybe you can :).
I prefer to be slightly more Einsteinian, and to have rules as simple as necessary, but no simpler.
 
And then; they might try and run through the interesting ways you can compose abstractions. While the mathematical precedence people will go "quit changing the subject, your language doesn't do what everyone expects!"
 
I don't know where you are going with this.
Is a dumber not correct version better?
Or perhaps I should say more regimented ...
 
Nothing is particularly correct about the behavior you keep defending. And I can show cool features empowered by my version. Except you're not particularly patient about it.
Let's start, very simply, from what the behavior IS.
(So hold on one moment)
 
6:40 AM
I don't think there is going to be a resolution here. You want regimented right-to-left infix without the ability to change it without parentheses, and I want freeform left-to-right infix with the ability to change it with a function call or a set-word. I think we have agreed to disagree on that one.
 
The R3-Alpha evaluator, when it was "finished with an expression", would step to the next item in the array being executed. If that item was a WORD! (and only if it were a WORD!, PATH! doesn't count) that looked up to an OP! it would take the result of the previous evaluation, make it the first argument to the OP!, and gather the second argument from the "next evaluation"
This idea of taking that step and peeking is what I have called the evaluator's "lookahead", so let's please standardize that term, at least for the purposes of understanding the code.
There are a number of interesting points about lookahead itself; including that it is done at a particular moment in time. We've discussed the irregularities of this moment you look at a word to see if it looks up to something "infix". What if the word is SET halfway through an evaluation here or there.
What if you DO/NEXT and it ends the evaluation with a WORD! that isn't infix, but then something else happens to make it infix, and you DO/NEXT again. These seeming philosophical questions do have actual practical ramifications in terms of the evaluator code itself.
As a solution to a number of problems I moved away from the idea that there are OP!s or "infix functions" as a category at all. There are merely words that wish to "lookback". So during the "lookahead" it is checked to see if a word has been SET in a way that suggests it wishes to "lookback", and if so there is a reaction.
So that is important, because this notion of lookahead and lookback being generalized has helped to formalize some of the more informal aspects of what was previously modeled as "infixness".
 
I am trying, and slightly failing, to be more patient, please, continue.
 
Want us to cover what the rule is.
So the small point of distinction is the question of "when do you lookahead and when do you not"
 
Trouble sir! I thought you just said there is no lookahead, that you've converted them all to lookbacks.
Well, we can use both terms I guess.
 
I said lookback is the most useful way, from a user's standpoint, of understanding the property from the word-bound-to-a-function's point of view.
But from the evaluator's perspective, lookahead is the implementation point by which the effect of lookback is accomplished.
The evaluator has just completed an evaluation, holding onto a value, but before returning it it does a "lookahead" to test and see if there's something in the next position that wants to "lookback" and further process that value before returning it.
Quickly going back to OP! in R3-Alpha, what happens is that after the value has been calculated ("left hand side") to lookahead sees a word bound to an OP! (e.g. that wants to "lookback")
But instead of evaluating this argument under the same rule set, it changes the rule. It says "while evaluating your second argument, do not use lookahead"
If you have a "purely infix expression" this gives the impression of left-to-right evaluation. So with "1 + 2 * 3" it starts with lookahead enabled (the default), evaluates the 1 (to itself), then looks ahead and sees the + which wants to consume the 1 as its first argument.
Then, it runs another evaluator step in a "no lookahead mode"
So it sees the 2, doesn't bother to look forward to see the *, and evaluates to 3. That subexpression which was evaluated in "no lookahead" mode is now complete--the recursion where the restriction applied is off the stack.
Now we're back in normal mode where lookahead applies, and it sees the *. The first argument is the 3, and to evaluate the second argument during a lookahead it again recurses in the special mode of no lookahead.
That is the essence of the rule. No shifting or reducing or anything. Merely "if the current level of recursion is processing the second argument of an OP!, disable the usual lookahead mechanic".
If you use only infix expressions, this will give the appearance of left-to-right evaluation. I'm not particularly impressed by that as a feature, especially given the fact that I rarely write purely infix expressions...or if I do write one, I might come in later with a subexpression that's not infix.
 
7:11 AM
If you replace "appearance" with "effect", we are clear on the rule.
But you are not saying that "coming in later with a similarly-resulting unparenthesized non-infix subexpression shall change nothing", I trust.
Woops, that was clearly impatient, sorry.
 
@MarkI I like (1 + 2 * 3) and (1 + add 1 1 * 3) being the same, and I have yet to see compelling value from it not.
The generalization of lookback, however, has driven lots of interesting features.
Those features hinge on the lookback-ing thing being able to treat its non-lookback arguments (of which it may have more than one) the same as other expressions consumed by Rebol.
I brought up x: default 2 + 3 as an example. If default looks back to get its x:, and then looks forward and is only allowed to see the 2, I don't think that's the behavior people actually want.
 
@HostileFork There is no parsing of your second example that results in 7 (or 9), since if lookback exists at all it forces the second argument to ADD to be 3.
 
A manipulator like 10 + 20 <| print 3 + 4 print "Hello" should print out 7, and "Hello", and result in 30. If lookahead were restricted in the gathering of its right hand side, it would print 3 and have an error on trying to add 4 to void. :-/
So this is where my analogy of trying to reason with people demanding "normal math precedence" comes in.
You have to first convince them that their definition of "normal" is probably misguided, then you try and show them cool stuff you can build by thinking bigger.
@MarkI I wrote the example wrong, I meant I like (1 + 1 + 1 * 3) and (1 + add 1 1 * 3) being the same. same processing when functions are involved
 
7:34 AM
Right, so it works only if your subexpression includes the end of the whole expression.
Or, equivalently, does not intercept any infix expression.
 
Well, the question is do you think there should be a reason for an expression to stop looking ahead for things that wish to look back. I feel like the natural ways of stopping it (e.g. a GROUP! or BLOCK! ending, or a BAR!) are easy and natural to understand.
The idea that while processing a certain expression category, the rule changes, just doesn't compel me very much while the features enabled by not changing the rule do compel me.
 
You have already said you don't use infix! Therefore by definition there will never be a compelling argument for you.
 
It would not be impossible to offer the choice for any argument on any function, as a processing mode, to say that it won't lookahead.
So it wouldn't be attached to infixness or anything like that. Just hey, while fulfilling this argument to this function, suppress lookahead.
 
Interesting.
 
And if people wished, that property could be applied to + and - and / and I would just not apply it to my <| or default or such.
 
7:39 AM
So provide it as a new flag on a parameter?
 
Yup. And maybe that would be enough to please everyone.
 
It may lead to unreadable code, but, what doesn't. I like it!
 
Well, it's a very "let the market decide" kind of choice.
 
Very fruitful conversation HF. Thank you.
 
Yip. :-)
 
7:53 AM
@DaviddenHaring @ShixinZeng ^-- the above conversation may be informative. It covers what's really going on, and suggests exposing the fundamental property as an option on function arguments. That flag could be used on the second argument of historical math operators to make them compatible with old code, while allowing the new "lookback"-based features to work.
 
 
1 hour later…
9:07 AM
This would not be my first choice. I mentioned that nothing makes me so happy about 1 + 2 * 3 being 9 while add 1 2 * 3 is 7...especially not that it justifies 10 = probe 5 + 5 not being an error and 10 = 5 + 5 being an error. :-/ The variance requires greater complexity in the evaluator...and less that users can take for granted when reading code. Hence my preference is the simpler rule.
 
 
2 hours later…
10:57 AM
„all in a zero-install, zero-config, single 1MB file“ that is truly amazing https://github.com/red/red #redlang #rebol
 
 
2 hours later…
1:26 PM
Nothing makes me so happy about 1 + 2 * 3 being 7 while multiply 1 + 2 3 is 9 ... especially not that it justifies 5 + 5 = 10 being an error and 5 + 5 = probe 10 not being an error.
Just pointing out that there are two symmetrical and otherwise undifferentiated approaches here.
Oops that last example is incorrect, and it is too late to delete it, sorry.
I've said too much about this anyway, I know everyone is sick of me and this.
I meant to say 5 + probe 5 = 10 not being an error.
Er, being an error (not being not an error). Too early in the morning, I can only proffer further abject apologies.
I stand by my symmetry claim though, and my claim that the left-to-right interpretation will be more familiar and more useful for beginners and power users alike.
It may be a sad, but it is a necessary, complexity in the evaluator IMO, and now I will shut up.
 
1:49 PM
@MarkI Again: the claim of left-to-right applies only to the completely reduced case of all infix operators. One cannot understand the general behavior without understanding lookahead suppression as a parameter property...and then realizing that only the second argument of binary "lookback" operators employs this property.
But, that's a benefit of the parameter tag. At least people can know what's actually going on. I think that seeing what's actually going on can help contribute to challenging it as an evaluator mechanism, because there seems to be misconception about how it was working under the guise of incorrect statements like "infix is left to right"
(Or calling it "shift-reduce".)
And maybe the reverse is true...in that once the ability is opened up to any parameter you want to give this property to...some application will be found that I do like. I can't say for certain that won't happen.
 
2:10 PM
Hm. You can force foo 1 + 2 to act as (foo 1) + 2 if you used the option on foo's argument...but what if a function is bound lookback and you say its first argument doesn't run lookahead? That sounds paradoxical (if the first argument of a lookback function doesn't lookahead, how would it run?) but maybe it's not a paradox, maybe the argument just looks like an <end>, e.g. this is a "punctuator".
 
The first argument cannot have lookahead, since it is before any step of lookahead is taken that it is determined that it will be a first argument.
That doesn't mean the property cannot be put to good use when it appears on a first parameter though, of course.
 
Well the natural thing I suggest there is that it forces the left hand side to be a complete expression, and then runs the function with a seeming missing first argument (end-able, like how (+ 1 2 3) can be set to accept an <end> on the left hand side and react accordingly). I was calling that a punctuator before.
It's a means for implementing user-mode expression barriers, for instance.
 
I understand, and suspect I may even grow to like, that.
 
The general logic I guess would be that the left hand side would have to be a complete expression before the operator ran.
1 + 1 foo 2 + 2 where foo has this property on first argument, but not on the second, would pass foo 2 and 4. :-/
property on second argument, but not first, would be 1 + (1 foo 2) + 2. Property on both first and second argument would be ((1 + 1) foo 2) + 2.
I guess there's no particular general value to making the argument appear to be missing. If one wishes to act as a punctuator in that case, just ignore the argument.
User-level, a function generator for writing punctuators may just give the argument a dummy name in the implementation and not expose it.
 
2:26 PM
I think this is going to be wicked awesome HF.
2
 
:-) Well, I certainly like it better if it means there's no punctuator flag, because then there's something that gets simplified as a result.
 
Win win!
We won't even have to invent a new parameter syntax, the existing get- and lit-word forms will work just fine, with both being differentiated and usable.
As in, we can look ahead after a group! and pass it instead of executing it.
 
2:43 PM
@MarkI Well this isn't precisely the same meaning as lit/get.
You can't have a lit/get without this property, but you can have this property on an evaluated parameter as well.
That said, given that lit form parameters can be implemented using the hard quoted get syntax, this might be a more interesting meaning for lit form than what we have today.
e.g. this could be more interesting meaning for lit-params than "if it's a group, evaluate after quoting"...since you could just hard quote and do that in the body anyway.
 
Right. Wait. What?
So there'd be 4 param kinds?
lit, get, and normal/with, normal/without?
 
Since we only just kind of came up with this notion, I'm going to have to look over the code before having a full opinion on it.
 
Too true. My impatience again. We'll get this, I can feel it.
 
The code is locked down really tightly so it makes mechanical impossibilities "pop out"
So if I can implement it, and no mechanical impossibilities occur, then we'll just have to see what the implications of that are in usage.
 
Anyways, since an evaluation has "just been completed", the get-word may not truly apply, was my last thought there.
 
2:54 PM
Right, currently you can only use "get-word parameter semantics" ("hard quoting") on the left hand side of lookback operators for things that did not evaluate. What I've called "semiquoted". Fortunately for default, we can do that with SET-WORD!
 
3:05 PM
Let me start just with the question of if this can do away with punctuators. All things that wish to have "punctuating behavior" must therefore be enfixed (a.k.a. SET/LOOKBACK). Because it is through that first lookback parameter that they get the mechanic to have any remark about "what evaluation came before"
That may kill the idea that procedures are punctuators, however. You want my-print: :print to work, and simple assignments like that do not carry over the lookback property.
 
3:52 PM
Argh. If we truly generalize it, we could say that all functions have one unit of lookback they may or may not elect to use. Then there is no SET/LOOKBACK, but there is a chance that any function could reach back for a parameter.
While this may feel a bit "precarious", is it any more precarious than saying that a function you are passed may take any number of arguments?
This would mean you would use the same kind of type checking on that lookback parameter that you might use to ensure your function takes exactly 2 arguments that are both integers. You'd just be saying it takes 2 arguments that are both integers, and doesn't have any lookback argument.
@MarkI ^-- Okay this... actually has the potential to streamline things considerably... perhaps it is the true endpoint of OneFunction, the death of ENFIX and SET/LOOKBACK.
so something in the spirit of func [arg1 [integer!] arg2 [integer!]] [...] => make function! [[dummy [<end>] arg1 [integer!] arg2 [integer!]][...]]
 
 
3 hours later…
7:04 PM
So the mechanical problem with unifying all functions under an umbrella like this is the question of "when do you stop a DO/NEXT". It's all well and good to say that in the case of 1 + 2 print "Hi", that PRINT just doesn't use its lookback slot so it gets 3 as a parameter but just throws it away. Works fine if all DO instructions go to the end, but they don't. all [1 + 2 foo bar], etc.
 
 
4 hours later…
10:58 PM
@RebolBot
obj: make object! [a: 10 b: 20 c: 30]
in obj [a c]
 
; Brought to you by: try.rebol.nl
== [a c]
 
@redbot
obj: make object! [a: 10 b: 20 c: 30]
in obj [a c]
 
; Brought to you by: try.rebol.nl
== make object! [
    a: 10
    b: 20
    c: 30
]
 
^-- Red giving what appears to be a wrong answer. The construct is intended as a reverse of bind, so do in obj [...] as opposed to do bind [...] obj
 
11:58 PM
@HostileFork Not quite sure what the issue is exactly HF.
[1 + 2 foo bar] stops DO/NEXTing:
(A) [1 + 2 | foo bar] after the 2 if foo does not look back (normal)
(B) [1 + 2 foo | bar] after the foo if foo looks back and is unary (postfix)
(C) [1 + 2 foo bar] after the bar if foo looks back and is binary (infix (op))
What am I not seeing?
 

« first day (2162 days earlier)      last day (1618 days later) »