« first day (1855 days earlier)      last day (1925 days later) » 

12:50 PM
@HostileFork You know you're removing "something infamous and much-disliked" merely to replace it with its logical negation.
 
@MarkI One might suspect the negation of something infamous and disliked could be good...
@MarkI In my "death to the function and closure distinction" concept, one thing to do is to kill the separate type but have a mutator. convert-function-to-broken (make function! [...]) Thing is that a closure gets a new copy of its body on each invocation, whereas the current function does not (which has always bothered me to view source and see it accumulating state)
So one answer that would prevent any spurious semantics would be if convert-function-to-broken made the body read-only.
Then, add a <lite> tag or similar to FUNC and FUNCTION to get it to run convert-function-to-broken on the created function.
 
 
3 hours later…
3:48 PM
@HostileFork If one were to ignore the fact that I said "logical negation".
 
4:46 PM
@MarkI Unless you interpret that as "sensible negation"
In any case, there were no eval-block! or eval-function! types, but there were lit-word! and lit-path! types that weren't going anywhere.
 
5:39 PM
@HostileFork One could argue that a paren is an eval-block. It's even called that in the code.
And I dispute your assertion that lit types (of which there are two, the two covered by your erroneous assertion) are not satisfactory.
But do not worry, I am not being critical, you are awesome.
I will say anyone promoting a lit bit may well benefit from a deeper study of why gets and sets also only apply to paths and words.
It would be, gotta say it, ridiculous to add a lit-paren type that can only be identical to a block.
In any case, these concepts are tied up with what the Rebol evaluator is supposed to be, something I am no king of.
 
6:06 PM
All I know is that there is a difference between "evaluation" and "dereferencing".
Currently "lit-" refers to the latter, and hence applies only to words and paths.
There is a small overlap because of parens in paths, but that is easily dealt with:
the purpose of a paren in a path is always to dereference the path.
So the result is always just another item that is searched for in a structure, or is appended to a string being built.
 
I am doing a hangman demo wih the kids, I want to print a - - - string as example where the guessed letters are added according to the guessword. So suppose "hello" is the secret word. I guess 'o' and the string becomes " - - - - o". Any handy ways doing this?
 
6:22 PM
>> targ: "hello" letter: "o" foreach s targ [prin either find letter s [s]["-"]] print ""
 
; Brought to you by: try.rebol.nl
----o
 
@iArnold Should have called it "letters" with the plural, but I hope you get my drift.
 
Thank you @MarkI Now the next letter guessed right.... oops! ;-)
 
@HostileFork I'm worried that you're trying to improve upon the QUOTE function. It works fine the way it is, and it is necessary the way it is.
@iArnold ??
>> targ: "hello" letters: "eo" foreach s targ [prin either find letters s [s]["-"]] print ""
 
; Brought to you by: try.rebol.nl
-e--o
 
6:31 PM
@MarkI Did that study.
 
@MarkI That's the one I was looking for! Thank you very much!
 
My conclusions of that study were that gets and sets don't just apply to paths and words, they apply to things that can be used meaningfully with GET and SET.
 
Which are paths and words. Currently.
 
@RebolBot
set [a b] [10 20]
print a
print b
 
; Brought to you by: try.rebol.nl
10
20
 
6:34 PM
And the only meaningful reason to apply a lit is to take away something's getness, which applies only to paths and words.
@HostileFork You are applying set to two words there buddy.
 
>> help set
 
; Brought to you by: try.rebol.nl
USAGE:
    SET word value /any /pad

DESCRIPTION:
    Sets a word, path, block of words, or object to specified value(s).
    SET is a native value.

ARGUMENTS:
    word -- Word, block of words, path, or object to be set (modified) (any-word! any-path! block! object!)
    value -- Value or block of values (any-type!)

REFINEMENTS:
    /any -- Allows setting words to any value, including unset
    /pad -- For objects, if block is too short, remaining words are set to NONE
 
I'm applying it to a block.
[a b]: [10 20]
 
Of words.
Hm. Interesting. So are you arguing for a set-block type?
 
set [a [b c] d] [10 [20 30] 40]
Yes, and get parens, etc.
Get parens to solve a particularly troubling parse issue
But get blocks have a similar application
I've been very displeased at the idea that there are rules that consume the results out of a paren in parse. It's somewhat discomforting, the idea of an accidental "leak out" when we've taken it for granted that if you see (...) that it will just run the code and toss the result
A get-paren could serve a few purposes, e.g. :(first [append reduce])
But most importantly to me is its application in forcing the above explictness in parse as a dialect tool, for the "leak out"
 
6:39 PM
IMO set [a b] [10 20] is better than [a b]: [10 20], since you are not setting the block, but the words in the block.
 
<shrug> Don't use it.
 
There are lots of ways to change parse.
 
Anyway, things on the roadmap, not what I'm working on right now.
 
@HostileFork Don't destroy the language.
 
@MarkI Last I checked I was pretty much fixing everything.
 
6:40 PM
And wonderfully. Just not the things you are destroying.
 
And what have I destroyed exactly?
 
Calling function! broken, for one. Stop doing that please.
 
It's not a minority opinion. Were earl here he would agree. I've also more or less established why COPY of a function cloning its body at an intermediate state is broken. If you really want a variation that unsets variables at the end of the run that's not a problem, that can be done.
 
As you well know what I want is a function that does no rebinding on invocation.
 
But the arbitrary reuse of variables and all the nuances with that is quite broken: github.com/metaeducation/ren-c/blob/…
 
6:44 PM
Garbage-freeness is a valuable attribute, as I have stated. Do not call it broken please.
 
@MarkI Performance aside, why would you want such a thing? It cannot distinguish a variable value in one stack level from another. It's one of those language-breaking ideas...
 
Believe it or not, for the one reason you hate it.
 
Look, some people will call C garbage and use assembler, or call x86 and use sparc.
 
-> "always bothered me to view source and see it accumulating state"
That's what I like. And want.
@HostileFork Um, my use of "garbage" was technical, specifically, the amount of memory uselessly allocated and freed just to support a closure invocation.
 
When in language Rome do as appropriate for that language. And for Rebol, definitional scoping is the Rome. But anyway, if you want fiddly "I want to shoot myself in the foot and live in a sort of hybrid world" then I'm not one who objects to the likes of inline assembly or whatever. Yet it's not going to be something the average user has to confront.
 
6:47 PM
Really that's one of our big differences HF. :)
 
I explained to you how it would be done, a tweak you call on the function value once produced. The average person won't and should not know about something they cannot reasonably be expected to control.
 
The semantics of function are much easier to understand than those of closures for someone who is unaware of either.
 
If you have one of these functions in which all bindings are equal, and A calls B and B indirectly calls A in a way the original A didn't anticipate, your variables are getting all swapped out
A passed B something it expected to be able to keep its meaning/binding, regardless of what incidental calls to A might happen otherwise. That is definitional scoping. That is a non-trivial part of the language.
 
FUNC is definitional scoping.
CLOS is a hack to provide a look-alike to dynamic scoping.
When you refer to a variable bound to a function!, and there is no call to that function on the stack, there is no definition.
The system can error or provide an unset! value, I don't care, but the scoping rules are clear.
 
Told you that is a completely orthogonal issue
 
6:52 PM
To you, of course, they are clearly wrong :)
I'm only responding to yet another strawman put up by you, you switched to this "indirection" argument.
 
Whether you want to build a generator that unsets the references at the end, or sets them to "banana", or whatever else... it's valid to want it and possible to do it.
And thanks to the layers and construction mechanisms being as they are, broken up how they are, not inefficient to do it unless you're really unhappy with the name "RETURN"
Even then, not so bad.
 
Let me see if I've got this straight.
You're OK with function! semantics as long as the variables are unset after the function returns?
Or are you saying that closure! semantics plus the variables being unset after the function returns is what anyone who uses FUNC should be using.
 
I'm not okay in particular with persistently mutable bodies. I do not mind offering it as a power-user feature or whatever, but these should not be contaminating the learning experience.
I'm not sure in particular that very many people use FUNC with the specific goal of having the variables unset after the function is done running. If that is their goal, they're not getting what they want.
 
I will try one more time.
I have a function.
I call it with the argument 7.
Somewhere in the function body a function-bound variable stores the argument.
In a nested function call, I can refer to this (outer) bound variable and get 7.
But if the function has returned, then when I access that same-bound variable I get garbage or crash.
Are you saying that if I change "garbage or crash" to "unset" that is an improvement that now makes FUNC semantics acceptable to you?
 
It's a legitimate property to want as unset, though I'd go farther to say read-only unset
 
7:03 PM
And I am sure you would like my nested reference to be read-only as well.
 
It would seem to me that some level of control over such things might be good, but I'm not the one asking for this kind of thing...you are.
In this light, where FUNCTION is a sort of "containing" abstraction while closure is a "leaking" one, the distinction starts to have value. It's not the same as needing FUNCTION! and CLOSURE! however.
Name-wise I'd think people are pretty used to function and that there's nothing intrinsic about the language to suggest functions would not act as "closures" by default. The words are slippery.
 
Unfortunately they are the only words we have.
 
Also, I think there may be a case where you want control on a per-local basis. Maybe some you are willing to let leak, others not.
With tags in func specs now you can imagine it's FUNCTION [<something>] or FUNCTION [arg [<something> integer!]]
 
Closures rebind. Functions do not. You can't get the latter with the former. And it's not the efficiency of it, it's that the binding takes place.
Rebinding "and then doing something else vaguely function-like" will never be acceptable over not rebinding at all.
 
@MarkI The properties of the thing you want are simply too poor to make a good case for considering "user mode".
If you want them as a power user feature, fine. But it's going to have to find its niche in the naming and system where those who want the thing with the bad properties are the ones who compromise.
It will not be the default you get when you type the word FUNCTION.
Call it FUNCTION [<no-rebind>] or use your imagination however you like.
The question of unsetting things at the end of the run is something less polarizing. I don't know. I guess that requires a survey of what people expect or want.
 
7:21 PM
There was a purpose to keeping function semantics in R3. It is sad you cannot see it, or worse, respect the people who fought for it.
 
You are free to write a paper about good uses for it. I will then feel free to show you how easily it goes south.
Just saying "principle of least garbage" is sounding a lot like "principle of wanting to say what sector of the disk my file goes on"
 
I am tired of you putting up straw men. Rebinding doesn't even have to create garbage.
 
principle of least user surprise and least broken code and principle of Rebol demonstrating its unique value well, and not crumpling to the ground the moment you try and combine techniques... that's a pretty good principle too.
 
Where one person, and one person only, gets to define what surprise and broken mean, it works perfectly, I agree.
 
I'm tired of you not sitting down and writing formal papers and programs and instead making up phrases and saying "because I want it!" Look, the point about a desired (not working today) concept of a function that unsets is a worthy one, I'll keep it in mind.
But the rest of this you need to realize that the bugs are subtle, user-surprising, there is no "feature" in it... only a performance assist.
I've dealt with finding these bugs, looking at them, and if you bother to read or react to anything I send like github.com/metaeducation/ren-c/blob/…
...THEN I will give you more credit. Sit down with a big bank of examples like that, now imagine users facing them.
Hard to find. Hard to write a precise repro case even when you know what the deal is.
If I, equipped with a debugger and a lot of insight, get screwed over by these things and then go messing with it and have a difficult time even creating the precise repro you can bet it's going to hamper a user...and no F-ing way it should be the default behavior for FUNCTION.
If you want that nightmare you are going to have to ask for it.
And you won't ask for it by using the most common word for making functions in programming languages.
 
7:51 PM
@HostileFork Here's my paper: "Don't dereference function words after the function has returned."
I must say that I do respect the opinion that, since it is impossible to programmatically determine when that happens, it would be better to have a language that just made it outright illegal, or have closure semantics, or something. But I don't share it.
 
@MarkI Here's my grade: "F-". This is a garbage collected language, and if you ever pass around blocks of words with the intention that they will be executed by other abstractions (the very foundation, as IF and WHILE themselves) then you really can't be sure exactly how those things work.
You want a design to be composable and there are things you can expect people to know and things you don't. You can't expect a system to work if people know nothing about their program, but you want the "separation of concerns" to at least give you a swimming chance at not having to know everything...else what good is the tool?
 
Don't ever return blocks that contain words bound to your invocation. Problem solved.
 
But if I ever pass data out (such as to a while-like or collect-like abstraction) and then get data back, the requirements of knowledge you're placing are too much. Especially too much to tolerate crashes or garbage.
Saying "never pass a block of data with bound words to your locals to a third party as part of your implementation" is untenable.
And in fact, directly violates the premise of the language's workings.
 
I respectfully disagree. I think the constraints are knowable, and understandable.
And I didn't say pass. I said return. That's the rub, after all.
 
Yes, but those routines you're calling give data back.
That data may contain some bits of material you passed to them. The requirements of control to say it will never happen are impossible.
 
7:58 PM
@HostileFork So, their promise is to not give you words bound to their just-vanished invocation.
What you gave them, they can return.
 
You may respectfully change the function: your implementation uses. I know too much about this problem and its failings. I can leave it in as a power user tweak for you or whoever wants to do it, but it won't be a separate datatype. It will be something you apply to function values once they've been created.
There are other options for "weird" things to do with functions that have been built... to go through and turn all the words that look up to functions into their function values so you don't have to look them up each time. And you'd get a "compiled-ness" like Red, sort of.
 
As long as all of the other gains of function! are maintained, I don't care how hard you make it for me to invoke them.
I am having this conversation for the people who never refer to function arguments after those functions return.
They should not have to pay closure prices for function behaviour.
 
But the closure price isn't related to that.
It's related to solving severe, crippling, bad bugs that jump out at you when you try to do creative things with the language--the very creative things that make the language at all notable.
If you want a fast broken system, there are plenty to choose from.
I'm focusing on getting speed from elsewhere, and making sure the things that should work do.
 
I see. "Returning stack-local words and then dereferencing them" is being creative, not stupid. My mistake.
I will look through your examples, and any others you care to mention.
 
@MarkI Crashing or reusing memory that was from a bound variable for another variable in a language like Rebol is stupid.
 
8:10 PM
For the moment, I believe "whether my caller can dereference any of these words I am returning" is determinable.
@HostileFork I 100% agree. I don't expect to be able to refer to values in one invocation by dereferencing words from another.
 
@MarkI And yet you think the bindings are "garbage", but how else do you propose to distinguish the words from different invocations? You could have some kind of signature but there's no room for the signature, if it were a counter it would roll over, etc.
 
But I would be happy with taking the topmost invocation, in the recursive case.
Um, I think we have a garbage problem.
 
A proper copy-on-write system would reduce not just that "garbage" but others, if it were thought through, but many of these things are isomorphism.
Anyway, I have things to do. You can have your broken implementation and your code can break and all will be well with the world.
 
Leaving me hanging on the garbage problem HF?
No worries.
 
But it's not going to be the one I'm going to subject people to out of the box. Perhaps the function vs. closure unsetting issue will stick around, but that's just a generator issue. But it means we'll have to call the building block CLOSURE!
And then that's the datatype, and then it's confusing in function specs.
Could just have synonyms. Whatever.
 
8:16 PM
@HostileFork How about "non-standard" instead of "broken"? Pretty please with sugar on it?
 
I proposed <lite> at one time as a tag for it. But I now believe <lite> would have to make the body immutable to not wind up being a total failure.
 
<efficient>
Joking. No insulting is necessary this time.
Actually, now that I think about it, I think I can find a use for accessing one invocation's variables by dereferencing another's.
 
Let's just focus on forward progress. I've mentioned the constraints and the flexibilities. The constraint is I don't want users to be bitten out of the box by the "efficiencies"; I want them to have a pleasing compositional experience in language-lego-dsl design that doesn't fall down on them unless they get greedy about performance.
 
It would be horrible, and probably not easy to see whether it could be done another way, but it's still an interesting problem.
 
Within that, the question of unsetting things and protecting them forever after a call is terminated for function or not, thus justifying closure's distinct meaning, is debatable. I still wonder if that might be done with a tag and--as I said--perhaps even a per-variable thing.
And what to call the names for playing-with-fire, another question, and just how the running with scissors tags will be broken up.
 
8:34 PM
I understand your position completely, HF, and I respect it. I am just asking myself my usual three questions, can I figure out what Carl meant by this (yes), does it work (not perfectly), and does it provide gains not available otherwise (currently mostly performance). We simply disagree on the relative import of the answers to Q#2 and Q#3.
 
@MarkI Well, as I'm about to show there's more than one way to attack performance. And it's often about presentation and the order of encountering the problems... who gets bit when, who's willing to put up with pain, who will be turned off before they can care enough to understand a tradeoff.
I want working magic out of the box.
The people who start to break the magic should be the special ones, because they got so interested they began to care enough to write programs whose performance they actually cared about.
 

« first day (1855 days earlier)      last day (1925 days later) »