quick question about verb_code on stunt

1 view
Skip to first unread message

d. kajsh

unread,
May 23, 2012, 9:16:44 AM5/23/12
to MOO-...@googlegroups.com
On Lambda/GammaMOO with LambdaCore-17May04.db, verb_code(#123,
"foobar") produces a list of indented strings, while on Stunt with
LambdaCore-17May04.db, you need to call verb_code(#123, "foobar", 1,
1) to get that result. Is that intended behaviour?

I skimmed the git log since this seems to be a change in the built-ins
or argument passing, but I couldn't find any relevant commits that
could be the source of this change.

Stephen Gigante

unread,
May 23, 2012, 9:20:46 AM5/23/12
to d. kajsh, MOO-...@googlegroups.com

I believe this is to do with the lambdacore #0:bf_verb_code override. Don't have a standard lambdacore right now, but it's rather easy to change the verb in your new DB to change it back.

-Stephen

--
You received this message because you are subscribed to the Google Groups "MOO Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/MOO-talk/-/UoybpBFTFY4J.
To post to this group, send email to MOO-...@googlegroups.com.
To unsubscribe from this group, send email to MOO-talk+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/MOO-talk?hl=en.

d. kajsh

unread,
May 23, 2012, 9:34:55 AM5/23/12
to MOO-...@googlegroups.com, d. kajsh
You're right, the different behavior seems to be due to the bf_verb_code override
in the stunt kernel package. I didn't even consider that.
To unsubscribe from this group, send email to MOO-talk+unsubscribe@googlegroups.com.

d. kajsh

unread,
May 23, 2012, 9:53:07 AM5/23/12
to MOO-...@googlegroups.com
What I meant to say was "while on Stunt with the LambdaCore package".
But as Stephen pointed out, it is in fact due to the bf_verb_code verb in the stunt kernel.
Since the server defaults to indented code listings
int indent = nargs < 4 || is_true(arglist.v.list[4]);
the stunt kernel should do so too, in my opinion.

Todd Sundsted

unread,
May 23, 2012, 11:24:44 AM5/23/12
to MOO Talk
Off hand, I don't remember why I defaulted it this way. I'll
investigate.

Todd

Todd Sundsted

unread,
May 26, 2012, 7:53:29 AM5/26/12
to MOO Talk
It turned out to be and error in the log.  I have attached a patch to
`#0:bf_verb_code()' and the entire code of the verb.  You should
either patch it or replace it:

=== patch ===

diff --git a/moo b/moo
index 78efa7f..47cfd2c 100644
--- a/moo
+++ b/moo
@@ -15,5 +15,5 @@ set_task_perms(perms);
 raw = 0;
 fully_parenthesize = 0;
-indent = 0;
+indent = 1;
 if (options)
   if (typeof(options[1]) == MAP)
@@ -26,11 +26,7 @@ if (options)
     indent = ("indent" in options) && "indent";
   elseif (typeof(options[1]) == INT)
-    raw = 1;
     `fully_parenthesize = options[1] ! E_RANGE';
     `indent = options[2] ! E_RANGE';
   endif
-  if (fully_parenthesize || indent)
-    raw = 1;
-  endif
 endif

=== verb ===

@program #0:bf_verb_code as application/x-moocode
{object, verb, @options} = args;

/* check arguments and permissions */
valid(object) || raise(E_INVARG);
`{owner, flags, name} = verb_info(object, verb) ! ANY' ||
raise(E_VERBNF);
perms = caller_perms();
perms.wizard || (perms == owner) || index(flags, "r") ||
raise(E_PERM);
perms.programmer || raise(E_PERM);

/* drop wiz-perms */
set_task_perms(perms);

/* interpret optional arguments */
raw = 0;
fully_parenthesize = 0;
indent = 1;
if (options)
if (typeof(options[1]) == MAP)
raw = `options[1]["raw"] ! E_RANGE';
fully_parenthesize = `options[1]["fully_parenthesize"] ! E_RANGE';
indent = `options[1]["indent"] ! E_RANGE';
elseif (typeof(options[1]) == STR)
raw = ("raw" in options) && "raw";
fully_parenthesize = ("fully_parenthesize" in options) &&
"fully_parenthesize";
indent = ("indent" in options) && "indent";
elseif (typeof(options[1]) == INT)
`fully_parenthesize = options[1] ! E_RANGE';
`indent = options[2] ! E_RANGE';
endif
endif

code = verb_code(object, verb, fully_parenthesize, indent);

chunks = this:_unpack_verb_code(code);

return (!raw && length(chunks) > 1) ? chunks[2]["source"] | chunks[1]
["code"];

/* security audit on Tue Sep 13 18:59:04 2011 EDT */
/* security audit on Sat Oct 1 18:04:47 2011 EDT */
.

Todd Sundsted

unread,
May 26, 2012, 7:53:57 AM5/26/12
to MOO Talk
That should have read "error in the _logic_".

Todd Sundsted

unread,
May 26, 2012, 7:55:58 AM5/26/12
to MOO Talk
And one more time as an attachment, since Groups mangled a line in the post...

--
You received this message because you are subscribed to the Google Groups "MOO Talk" group.
To post to this group, send email to MOO-...@googlegroups.com.
To unsubscribe from this group, send email to MOO-talk+u...@googlegroups.com.
bf_verb_code.moo
Reply all
Reply to author
Forward
0 new messages