REBOL3 tracker
  0.9.12 beta
Ticket #0002153 User: anonymous

Project:

Previous Next
rss
TypeWish Statusproblem Date12-Jun-2014 03:25
Versionr3 master CategoryMezzanine Submitted byfork
PlatformAll Severityminor Prioritynormal

Summary Alter ?? meaning in DO "dialect" to just do what PROBE currently does
Description I knew there was a ?? in PARSE. I used to use it for debugging but had switched over to using `pos: (probe pos)` instead, because it had historically seemed to have a lot of problems.

Even today I'm not sure if this output is right or not:

>> parse "aaabbbccc" [some "a" ?? some "b" ?? some "c"]
some: "bbb
some: "ccc
== true

Now that it's open source I should go back and look into it, because that's useful. "Print some debug information but don't affect the expression... keep going."

I didn't know that there is one in regular Rebol too:

USAGE:
    ?? 'name

DESCRIPTION:
    Debug print a word, path, or block of such, followed by its molded value.
    ?? is a function value.

ARGUMENTS:
    name -- Word, path, and block to obtain values.

But I don't think this is a good implementation. It certainly isn't useful in an interactive session...

>> foo: 10
10

>> ?? foo
foo: 10
== 10

Yes, I know it's foo--because I just invoked it with that parameter!

So the only sensible reason it would dump the name would be if it was in the middle of an expression of some kind. Kind of like how the ?? in PARSE works, where it is a non-destructive way of getting some info about your state.

Except it doesn't work. Due to the lit-quoting, it becomes "invasive"... and breaks things:

>> x: reduce [1 + (a: 2 + 3) + 4] print a
5

>> x: reduce [1 + (?? a: 2 + 3) + 4] print a
a:
** Script error: a has no value

It's not possible to lit-quote an argument and not be destructive in this way.

The better thing seems to be to make it equivalent to what PROBE does today. That way it can be nondestructive, is shorter to type, and parallels PARSE nicely.

Furthermore, that adaptation *should* pacify experts regarding the impact of CC#2152...which is a proposed usability adjustment to PROBE, helping it assist in cases of intent to debug a value conceived of as in-between expressions.
Example code

			

Assigned ton/a Fixed in- Last Update22-Jun-2014 01:08


Comments
(0004455)
BrianH
22-Jun-2014 01:06

What PROBE does today is to allow you to print out a value, usually for debugging, without affecting an existing expression. But the trick of course is that values don't have names. ?? lets you debug the name as well, in those more-rare occasions when you can pass it a name instead of a value. They necessarily have different calling conventions, since ??'s ability to print out a name means that you actually have to have a name in the argument list, not an expression.

I can see the argument for reversing the meaning of the two functions, but I'm not sure it's worth the compatibility issues. We definitely need both though.

Date User Field Action Change
22-Jun-2014 01:08 BrianH Category Modified Unspecified => Mezzanine
22-Jun-2014 01:08 BrianH Status Modified submitted => problem
22-Jun-2014 01:07 BrianH Comment : 0004455 Modified -
22-Jun-2014 01:06 BrianH Comment : 0004455 Added -
12-Jun-2014 03:25 fork Description Modified -
12-Jun-2014 03:25 fork Ticket Added -