Shell-style programming in Kawa

Per Bothner per@bothner.com
Thu Feb 13 22:29:00 GMT 2014


On 02/13/2014 02:04 PM, Jamison Hope wrote:
> Very cool.  Is there something special about how kawa.lib.system
> definitions get loaded?

There may be, but not that I can think of off-hand.
The predefined bindings are defined in Scheme.java,
and the way they're resolved is probably slightly different
that something required'd.  I'd have to track the code-path.

I'd start with a print statement in ReferenceExp.validateApply,
and maybe a 'new Error().printStackTrace()' in InlineCalls.maybeInline.
That latter will tell you where you're supposed to end up,
for the working case using the pre-defined pipe-process.

It's possible the logic for checking for validate-apply gets
side-tracked before it gets to InlineCalls.maybeInline.

> If I copy/paste pipe-process, %pipe-process,
> and pipeProcessValidateApply into a new file with slightly changed
> names (appending '2' to each), the validate-apply key gets ignored:
>
> #|kawa:1|# (require test.test_inlining)
> #|kawa:2|# (pipe-process2 "abc\ndef" &`{grep a})
> java.lang.RuntimeException: %pipe-process2 called

Have you dis-assembled test.test_inlining?  Make sure that
that the class+method specified in validate-apply exists,
is public, is static, and has the right signature.

I'd also put in a print statement (easiest is a (format #t ...))
in the validate-apply.  However, if it does called and doesn't
match you should get an error, so that is less likely.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list