« first day (1576 days earlier)      last day (2204 days later) » 

12:04 AM
The main issue I ran into with making APPLY use refinement names rather than being positional is that it makes it extremely difficult to use APPLY for its primary use: wrapper functions that pass through options to the functions that they're calling. The main issue is that inside the function the option words are set to true or none, so there's no way to indicate which refinement it corresponded to.
If you have to specify the refinement names in the call to APPLY, you have to either compose the block that you're passing to APPLY (so you get the right names) or use conditional code to pick the block you're passing in. Either way, the code using APPLY would be just as complicated as the code using regular function calls which APPLY was supposed to replace.
Being positional means that you can specify that a particular option not be included without having to remove the section of code for that option's values.
So far it seems like you get a choice: Either be positional and be sensitive to the declared order of function options, or use named options and make APPLY useless for wrapper functions. Awkward and fragile beats completely useless any day of the week.
Weirdly enough, Ruby has solved this issue nicely by passing in its keyword-optional parameters as a Hash value (similar to our map! type), rather than as regular arguments. This makes passing options through to other functions pretty easy. But we'd have to change the semantics to be closer to Gabriele's Topaz proposal (no link, sorry, the site he proposed it on has been down for years).
This is what I meant when I said "I haven't really had a chance to come up with something better, though I've determined many worse methods.". One of those worse methods was named refinements.
 
@BrianH I had a USES function that took that approach: foo: uses [bar: 1 foobar: none][bar * foobar] foo [foobar: 3] foo [bar: 2 foobar: 4] except you don't get type checking this way...
Although no reason why that couldn't be added, I suppose.
Used it for Google Charts.
 
12:22 AM
@rgchris using a different method of declaration you could get type checking, but then you'd have different declaration syntax and call syntax. But it's notable that Ruby doesn't even have the level of type checking that Rebol does, at least not in function argument lists. Attempts to add it in Rubinius are notably incompatible with the keyword arguments added to recent Ruby. The Ruby communities are more fractured than the Rebol and Red communities, on occasion.
 
D'oh!
 
Wait, I think I figured it out! One way that you could do named-refinement APPLY is to pass in the refinement and options in the argument block, but choose whether to provide that refinement and its associated arguments to the function based on the value assigned to the corresponding word. So, apply :append [[] [5] /only] would pass on /only depending on whether the word only had a truthy value assigned to it.
That would mean that you'd be passing in both the name and value, and know that you were doing so based on the argument being of the refinement type.
APPLY/only would disable that of course, passing in the refinement value as a refinement value.
 
@BrianH I don't quite understand. Apply expects and passes on truth values in the refinement spots, right? So wouldn't passing in the refinement be just like 'true?
 
It wouldn't require any more conditional code in wrapper functions. It would require you to declare local variables with the same name as the refinement you pass in if your wrapper function renames options. This would also make APPLY extremely difficult to use if the option name was the same name as an existing word you didn't want to change the value of, like /if.
 
Or are you saying that 'apply does not even look at what the function is expecting as refinements ...
 
12:38 AM
@MarkI APPLY currently is positional, which makes it sensitive to the declaration order of function arguments. We are trying to figure out how we could do things differently without making APPLY useless.
 
@BrianH By positional you mean it "builds" up a set of arguments that is assumed to match the spec, in the order of the spec, am I right?
That's why none's get filled in for missing ones?
 
@MarkI APPLY currently doesn't look at what the function is expecting as refinements; it just passed the value to the argument at that position. If the argument at that position is a refinement, the truthiness of the value you're passing in is used to determine whether that refinement is chosen in the function call.
 
@BrianH Ah, right. Is it too expensive?
 
It doesn't consider the name of the function option, just it's position as declared.
 
I mean, it could parse the spec. I'm not saying it should ...
 
12:43 AM
@MarkI as it is now it's not expensive. I don't know whether my alternate method would be too expensive. The only reason we haven't tried it is because no one thought of this until just now. What people have thought of was horribly wrong, which is why we hadn't done it.
 
@BrianH I don't know if I would describe "apply could parse the spec" as horribly wrong ... :)
 
@MarkI it does parse the spec currently, sort of, it just doesn't consider the names. It just goes by the types of the arguments, in order of specification. The problem with considering the names is that it would have to look them up at runtime. I don't know how expensive that would be (at best m*n rather than n), so we don't know whether the usability tradeoff would be worth it.
 
@BrianH Of course. I can see it going off the rails if you're using a million refinements.
 
@MarkI no, it was judging whether the option should be applied by whether its refinement name was included at all in the argument block that was horribly wrong, since it made the conditional code around using APPLY as bad as it is around as regular function calls.
 
@BrianH Right.
Although the conditional code I have written to build up function paths (before R2/Forward) is no better really. More like a question of which ugliness hurts less ...
And it is a great thing that both ways are actually possible, with type checking.
Doesn't hurt to beat the Rebol drum occasionally!
 
12:52 AM
In comparison, if you are choosing based on the values assigned to the words of the same name and binding as the refinements, that doesn't require any more conditional code than the positional APPLY, and isn't sensitive to option declaration order. It can be, on the other hand, awkward depending on the name of the option and binding context at the place of the call to APPLY.
 
@BrianH Isn't it enough to either have the refinement (with the correct name) or none? We don't have to know the names of the refinements that aren't being turned on ... do we?
 
If we want to make APPLY really complicated, but make the easy use possible and be backwards compatible with most existing code, we could support both positional and refinement name value models. This is too much to explain in a message here. I should write up a proposal for CureCode.
 
@BrianH I eagerly look forward to reviewing it. It is good to know that it remains theoretically possible, but I insist I wasn't asking you to do more work ...
 
@MarkI internally, Rebol is stack-based. It evaluates stuff in order and pushes it on the stack. Evaluating path expressions that result in function calls means taking the arbitrary order options specified in the path and turning them into a stack frame that has arguments in their declared order. This is somewhat tricky code. APPLY is simpler by comparison, but would have to be made just as tricky to support knowing about refinement names.
@MarkI no problem. It's nice to think about something technical outside of work, for a change. Fun times :)
Tragedy of tragedies (for this community) I don't use Rebol at all at work (at least officially). I do use it for throwaway one-off analysis scripts, but if I have to do anything that will be used more than once I have to write it in Ruby.
 
1:09 AM
@BrianH That must be annoying. I find Rebol is actually faster than awk or sed or ...
For one test-results chart, my Rebol code runs in under a minute; the equivalent awk script, highly optimized, takes about 5.
Well, highly optimized, who knows -- I didn't optimize it. But some proud awk guru did!
(I haven't shown him the Rebol code yet.)
 
@MarkI I find that to be true as well, though I've had to use awk and sed more than I like recently. Ruby is more comparable if you can accept that it takes 10 times the RAM and 150 times the disk space as Rebol for the same operations, due to them not being that concerned with efficiency until recently.
The only advantage to Ruby (aside from that argument handling bit I mentioned earlier) is that for most operations, while the corresponding Rebol code would be better, the Ruby code was already written by someone else. Wide usage has its benefits.
 
@BrianH Hahaha 150x disk space. Everything takes more disk space than Rebol ...
@BrianH Ruby has a huge following? I just learned it a couple years ago ...
OK, sorry, that was Rails.
 
@MarkI I was being generous, actually. Given the need to support multiple versions and even overestimating the size of Rebol, it's probably closer to 200 times, per version.
@MarkI most people only use it for Rails, though some use it for other web services. It doesn't get much use for other stuff. But you underestimate how many hundreds of sites are written with Rails, employing many programmers each. Even if it's a small percentage of the number of web developers as a whole, it's still many thousand programmers.
 
I wonder if Yukihiro Matsumoto would say Rebol has "the smell of a toy language".
 
Github is written in Ruby, for instance. In an annoyingly older version of Rails, because Rails was apparently not written with version transition in mind, so major version upgrades require you to rewrite your damned site almost from scratch.
@MarkI Rebol was one of his influences, actually. Ruby tries to fake dialect support; not as well as Rebol, but good enough for a lot of purposes.
 
1:23 AM
@BrianH <dumbstruck>
 
Rebol did a lot of cool things in the '90s that other language designers found impressive, and tried to replicate in their own languages (the whole "messaging language" thing). They couldn't use Rebol directly because it wasn't open source back then. That's why we have the industry using things like JSON, for instance, rather than Rebol.
Crockford invented JSON because he couldn't convince Carl to open source Rebol at the time.
2
Oh well. Better late than never.
 
@BrianH Indeed. And even if it doesn't "take off" -- whatever that means -- at least I am happy because I can continue to use it. Forever.
 
@MarkI I wish I could use it more. While there are things I like about Ruby, I miss Rebol and am missing out on Red.
 
@BrianH Do you use it at home? Most of my non-work computing is in Rebol ...
But, I have no life :)
 
@MarkI I've barely done any non-work technical stuff for 2 years, due to work taking up all of my usable brain time. I actually bought a few Raspberry Pi's recently to try to encourage myself to do more technical stuff that can't possibly be used for work (hoping to use them with Red, among other things). We'll see if that helps.
That ARRAY revamp I just wrote in the last day is the most significant Rebol work I've done in the last year.
 
1:38 AM
@BrianH I pray it does. And I hope you take regular 15-minute breaks, though I would be willing to bet you don't :)
I have to force myself to do it too. But it does help, a lot.
 
Also, while I used TerminalIDE to port Rebol to my phone before, it turns out that it doesn't work on Android 5 (Lollipop). I'm going to try starting over with a new C dev environment.
Has anyone gotten Rebol to compile with TCC, or should I use GCC again?
Also, and I realize I missed out on requesting this at the time, I heard that Carl put out a request for R2 fixes. Did anyone else remember to request that the Needs header handling be relaxed so it was no longer an error if something other than the libraries were requested? R2/Forward had been blocked since 2009 because of this, and I requested it of Carl in 2008.
 
@BrianH I don't remember anyone mentioning it. It wouldn't hurt to add a comment about it. Perhaps it could provide Carl with another bump to finish what he started
sounds like he already completed fixes for a couple things but they weren't posted anywhere
 
@kealist oh, it hasn't been released yet? Cool, I'll add a comment.
 
1:55 AM
@rgchris I will have to take a good look at that. Thanks for the example
@BrianH Sweet. Hope those fixes actually come out. Need more than a drive-by
 
2:24 AM
@kealist comment added. I'm not too annoyed about this anymore because I barely use R2 now, but for several years this was a big problem. Now it's just a problem for the people who use R2/Forward.
 
 
2 hours later…
4:37 AM
posted on February 23, 2015 by BrianH

[Comment] It's not "built" until it's merged.

posted on February 23, 2015 by abolka

[Comment] Follow the PR link: it has been merged.

 
 
6 hours later…
10:30 AM
@BrianH It's nice to see you back! Would you also take a look at the unusable monstrosity caller "R3 Module System"? Current incarnation is something totally awful.
 
 
4 hours later…
2:00 PM
X becomes less usable every day.
 
2:54 PM
@HostileFork - maybe you might ask Carl about the planned R2 fix release? The blog article is getting older and no new version was released yet. If my understanding is correct, you are in occassional contact with Carl?
 
3:41 PM
I have a super-dumb question about the "fix" for return/redo. Was it excised simply because you need to be intelligent to use it? That's a bad reason in my opinion.
I mean, as far as I am aware, there is no over-arching 'Rebol must be amenable to static code analysis' language restriction, am I right?
I am actually pretty sure I can screw static analysis without using return/redo, for example.
I am all for 'apply not using return/redo, but that's a different question.
 
 
3 hours later…
7:10 PM
@rebolek there is a set of stories to fix all of the usability issues, one of the epics in CureCode. It's the top of my list, but how quickly it gets done depends on how much brain time I can allocate to Rebol at the moment. I'm in the middle of a big refactor at work (pretty much at any given point, since I'm one of the main refactor guys).
@MarkI it was because it was extremely difficult to use safely, and pretty much all of the restrictions that you'd have to adhere to in order to use it were already done by DO. Also, if by "static code analysis" you mean "a developer reading a set of source code and understanding what it does without having to run it" then yes, our security model depends on it.
 
@BrianH - hi! :-) Hopefully you will be able to find some free time in the future and you will not completly forget about the Rebol ecoland. :-)
 
7:50 PM
@BrianH Wow. Just ... wow. Is that definition materially altered by restating it as "a Rebol program can determine what source does without having to run said source"?
Hint: You know I'm setting you up, big time, with that question ... :)
 
8:07 PM
@MarkI actually, yes, it would be hypothetically possible to write a Rebol program that would use the same analysis method that a developer would use when reading the source. The process is quite similar to static analysis. I've already done some work on this, actually.
 
@BrianH So, you've said, "The definition remains significantly the same in that wording."?
 
@MarkI Yuo. Right now we don't have things locked down enough to be able to run untrusted scripts. So in order to be secure, we have to be able to trust scripts. If you don't personally know the developer who wrote the script, that means you have to read the source before running the script and see whether it does anything evil. That process is effectively (advanced) static analysis.
Debugging is a similar process.
 
@BrianH Awesome. How do you avoid the Turing pitfall? You've essentially solved the halting problem ...
Unless Rebol is no longer Turing-complete in this guise.
Which, the more I think about it, may not be totally a bad thing. Or even necessarily an avoidable thing ...
 
8:44 PM
@MarkI I assume whatever is being discussed isn't considering infinite loops to be evil, and is checking for some other definition of evil. Not to say I understand what that definition is.
@pekr Haven't heard back from Carl on the last mail. Don't know about the R2 fix as a public release. Perhaps others can take a shot at reaching him through other avenues.
 
@HostileFork Well, the whole Turing thing is that it's (ridiculously) easy to convert a property of a program into a program that terminates iff that property is true on its input considered as a program. The halting problem is not just about infinite loops!
 
@MarkI There are knowable negatives about programs in static analysis, which can be known even if those programs are Turing Complete. For instance in C++: "can this program be guaranteed not to call printf".
If the goal is to prevent "evil things", this may be the kind of thing he's describing. Like I said, I don't know. My point was, he's presumably describing that kind of "prevention of evil" as opposed to program proving of lack of (for instance) infinite loops.
 
9:03 PM
@MarkI this doesn't really solve the halting problem, but it does solve the problem of knowing how many arguments a function takes, and thus evaluation order. It's a matter of being able to know function specs based on being able to track down the functions themselves. Start with a known world and build on it.
Also, I don't assume that infinite loops are evil. People write servers in Rebol that aren't supposed to halt.
 
1
Q: How to avoid function invocation in COMPOSE-like circumstances?

HostileForkIn the following code, we can assign the result of a GET-WORD to p through a SET-WORD, and then use it under the new name: p: :print p [{Hello} {World}] But what if you are using COMPOSE, and you find a situation such as this? do compose [p: (:print)] p [{Hello} {World}] That gives an err...

@BrianH --^ this has been something of an issue in the C++ binding
Literal function values expressed in source execute unless you quote them.
So I started thinking about the activation bit in return/redo
Wondering if some way of saying "this function should be triggered" could be encoded in a function value, as a generic service. Should a function result come back with that state bit, it be run again. Should you meet a literal value as you run in a series without the bit, it is just used as its value. But if activated, it is called.
Anyway, it just might show that there are more general uses for "activated" vs. "unactivated" functions and rethinking how that's done.
 
9:26 PM
@HostileFork it should be easier to solve in a binding, hypothetically. With a binding and the right API you should be able to be more intrusive into the evaluation process so you can halt between operations. Of course this presupposes that "the right API" exists, that you aren't limited to treating the interpreter as a batch-mode black box.
I'm not making that assumption, currently, since this isn't yet a question I've asked.
 
 
3 hours later…
11:57 PM
@johnk How would I restart RebolBot's AltME? I suspect it's not keeping up...
 

« first day (1576 days earlier)      last day (2204 days later) »