« first day (3324 days earlier)      last day (456 days later) » 

1:10 AM
I mention "dynamic specialization" here, and it's something that is coming up an awful lot. As the formulation I show there gives, it's more or less "an ADAPT that removes parameters". I wonder if as with AUGMENT, maybe we're looking at another primitive that just erases parameters from a function's interface and does nothing besides that...a DEAUGMENT (DIMINISH?)
 
 
2 hours later…
3:10 AM
posted on December 07, 2019 by @hostilefork Brian Dickens

@hostilefork wrote: A lot of influencing factors have changed over time. Before making another major change, I want to run through the history of reasoning and look for any gaps, given modern understandings...in case some turn was taken that we would not take again given what kinds of things we know now. To that extent, I'm going to somewhat "sanitize

2
 
3:53 AM
@Feeds ^-- I feel pretty good about the reasoning here--things hold up pretty well. But the only place I'm having cold feet is that while it seemed okay for explicitly marked optional arguments to take NULL (e.g. append [a b c] null all right, append null [a b c] not), every refinement argument is implicitly optional and revoked by null. So soft failures are...quite soft indeed. Maybe that's fine. :-/
>> append/dup [a b c] [d e] 2
== [a b c d e d e]

>> append/dup [a b c] [d e] if false [2]
== [a b c d e]

>> apd: :append/dup
== make action! [[series value dup /part /only /line] [...]]

>> apd [a b c] [d e] 2
== [a b c d e d e]

>> apd [a b c] [d e] if false [2]
== [a b c d e]
^-- I'm not sure how I feel about that. Once you've said that apd is :append/dup it's arity 3, and the optionality seems like it's no longer part of the deal. Though you might then ask why it would have been optional if you hadn't pre-specialized.
Refinement revocation originated from practical concerns about trying to write variations of functions where you'd end up permuting the branches to have different forms with the refinements, like either pos [append/part series value pos] [append series value] or similar. And it's a good thing.
I guess the point in support of APD above letting you opt out is that you know for a fact that the function implementation is capable of handling the case where that value is nulled. Because it was written that way. Making it suddenly mandatory is an artificial constraint...which you can add if you like: apd: adapt 'append/dup [ensure integer! dup]
Probably I'm worrying about nothing, when language goals are considered: the power/freedom/accuracy is more important. But it helps understand just how "soft" a soft failure is. It really means "it wasn't an error, the caller quite expected a nullptr case to happen". Thus it makes a bad choice for the return result from square-root -1.
There could be a notation for marking refinements optional or required. :-/ Previously I suggested maybe [x]: null would be an error, where the block enforced non-nullness (part and parcel of "you can't have null in a block"). Maybe apd: :append/[dup] would remove optionality from the parameter.
That feels backwards, because it would seem you'd want to mark the optional cases. I went down that path with /x: null and /x for optional access. But that's a whole lot of extra markup and hassle for protection nobody was really asking for. It was never supposed to be a "safe" language, it was supposed to be fun and flexible. So again, I'm probably barking up the wrong tree by worrying, here.
 
 
4 hours later…
7:55 AM
posted on December 07, 2019 by @hostilefork Brian Dickens

@hostilefork wrote: If I've done my due diligence in reasoning through a world where NULL is normalized, then being able to have your code assert places where you did't expect a NULL is pretty important. Once upon a time, this was called ENSURE: >> append x ensure select [a 10 b 20] 'c ** Error: e.g. "Couldn't ENSURE you had a value, it was NULL"

 
 
4 hours later…
12:18 PM
posted on December 07, 2019 by hostilefork

Certain invisibles seem to have trouble when non-word! precedes them, e.g. ASSERT: >> x: 1 reduce [x (assert [true])] == [1] >> reduce [1 (assert [true])] Assertion failed: kind.byte == REB_WORD, file C:\Projects\ren-c\src\core\c-eval.c, line 2341 For some reason, ELIDE does not have this problem: >> reduce [1 (elide [true])] == [1] The 0-arity "NIHIL" invisible gets anot

 
 
7 hours later…
7:01 PM
@Feeds For those who don't read the punchline above, NON as the "anti-ENSURE" looks pretty darn cool...
    >> ensure [integer! text!] 10
    == 10

    >> ensure [integer! text!] <something>
    ** Script Error: Didn't match types you gave...

    >> non [integer! text!] <something>
    == <something>

    >> non [integer! text!] 10
    ** Script Error: Hey you said it wasn't but it was
Then we can say things like append block non null x. Which is pretty literate-looking, and could work with other types append block non any-array! x.
 
7:15 PM
So this is starting to lend itself to things like let add: (=> append block non null) making impromptu dialects local to a function for your convenience. add item1 | add item2. These little bricks are the "Minecraft of Programming" I am talking about... and perhaps paint a picture of how to be at ease moving away from my more traditional ideas of what "safety" in a language means.
2
 

« first day (3324 days earlier)      last day (456 days later) »