REBOL3 tracker
  0.9.12 beta
Ticket #0002148 User: anonymous

Project:

Previous Next
rss
TypeNuts Statusdismissed Date10-May-2014 22:01
Versionr3 master CategoryUnspecified Submitted byfork
PlatformAll Severityminor Prioritynormal

Summary Abbreviated hyphenated forms for IF-EQUAL, EITHER-ZERO, etc.
Description I'm self-categorizing this as "nuts", but then again... maybe it isn't nuts.

It was some time before I learned TO existed. Before that, I thought that TO-STRING and TO-WORD were foundational, so I'd write case statements on types which would test the type and use the right hyphenated TO.

Once I found out about TO then I thought all the TO-*** functions should die. How much more typing was it to say TO STRING! than TO-STRING... it did not seem worthwhile. Also, I felt that hyphens "belonged to the user"; and that Rebol should be living up to its "words separated by spaces" programming principle.

Objections were that in the flow of Rebol usage, both the exclamation point's visual abruptness... and the requirement of hitting "shift" to get it... made this common operation worth doing a cross-product for.

In Rebmu it came up that shorthands were needed for common conditional structures. So there are things like IE for if-equal, and EZ for either-zero, etc. They come in handy. Which made me wonder: are these things handy for general programming as well?

x: 10
if-equal (x + 10) 20 [
print "They are equal"
]

y: 0
either-zero y [
print "y is zero"
] [
print "y is not zero"
]

As with TO-STRING, you're not really saving all that much characters with EITHER-ZERO over EITHER ZERO?. But you are saving that shift, eliminating a question mark by folding it into the operation, and in the case of something like IF-EQUAL it might be argued that you're de-stigmatizing the prefix form of an operator.

There actually aren't that many of these (when compared to the combinatoric explosion of types.) And it's another case of being able to make techniques adopted in Rebmu puzzle solving not "just a Rebmu thing" but something that a puzzler could carry into Rebol.

Just putting the idea out there. Again, coming from someone who didn't like the TO-*** operations... but then flips back and forth on that, depending on the day.
Example code

			

Assigned ton/a Fixed in- Last Update22-Jun-2014 22:59


Comments
(0004421)
Gregg
12-May-2014 19:23

Doesn't grab me right off, but I also prefer TO to TO-***. Is there a single func, or names that would be a better solution. I agree that these forms come up repeatedly, but just hyphenating things doesn't seem to add much value.
(0004452)
BrianH
22-Jun-2014 00:25

I agree: Nuts. Doesn't add anything, and saying that we don't want to get rid of TO-* doesn't justify adding these. Sounds like a great thing to add in your own code if you think it's worth it, but I don't see the value of these even as third-party library functions.
(0004471)
fork
22-Jun-2014 22:59

It's interesting to ergonomically run through the task of typing:

to string!
to-string
if zero?
if-zero

Perhaps because I'm right-handed, the typing flow of `to string!` is a bit more stressful than if zero?, because the left hand must hit the shift and the one to get the exclamation mark, while a question mark I produce with left hand shift and right pinky on period.

Anyway, I brought it up because the hope here is an articulation where one can really understand why the TO- is good and these are nuts. Rebmu is trying to edge away from cases where the choice is between matching Rebol (vs. introducing some wacky thing that doesn't teach any concept in Rebol). That's where this arose.

I guess what I'd like is a strong articulation of why this is nuts and the TO-XXX variants are not. I don't mind if it comes down to which finger is pushing the shift key for what symbol, but I'd just like a stake in the ground as an answer.

Date User Field Action Change
22-Jun-2014 22:59 Fork Comment : 0004471 Added -
22-Jun-2014 00:25 BrianH Comment : 0004452 Added -
22-Jun-2014 00:22 BrianH Description Modified -
22-Jun-2014 00:22 BrianH Status Modified submitted => dismissed
12-May-2014 19:23 Gregg Comment : 0004421 Added -
10-May-2014 22:01 fork Ticket Added -