[parenscript-devel] Skipping null returns at the top level.

szergling senatorzergling at gmail.com
Wed Feb 3 19:29:32 UTC 2010


On 2/1/10, Vladimir Sedach <vsedach at gmail.com> wrote:
> I just pushed a patch that should do the right thing; take a look.

That works, but the functionality is missing from ps-compile-stream
(and therefore ps-compile-file), so I've added this too (see patch for
inspiration, or if it's acceptable/modifiable, merge?).

I also wonder if (in case I wasn't clear in my original email) this
actually makes more "sense" for parenscript?

(lambda () nil) => function () {return null;}

(lambda () (values)) => function () { }

(lambda () (values 1 2 3)) => function () { ok, nevermind??? }

Not sure either way.

I don't think my changes have broken anything in the meantime :)
However, while all the tests passed, there's a warning too:

Running other tests:
...........................................................................................................................................;
in: LAMBDA NIL
;     (PARENSCRIPT::PS-COMPILE PARENSCRIPT-TEST::X)
;
; caught WARNING:
;   undefined variable: X
;
; compilation unit finished
;   Undefined variable:
;     X
;   caught 1 WARNING condition
.................................................................................

I could not hunt down (quickly) the cause of this warning, so I
haven't done anything.

Thanks for the good work!

Yong

> Vladimir
>
> 2010/1/27 szergling <senatorzergling at gmail.com>:
>> On 1/27/10, Vladimir Sedach <vsedach at gmail.com> wrote:
>>> I've also found that annoying about macros. I'm going to see what can be
>>> done.
>>>
>>> Vladimir
>>
>> Thank you. Look forward to it.
>>
>> By the way, I think implicit return is a very useful feature.
>>
>> Yong.
>>
>>
>>> 2010/1/26 szergling <senatorzergling at gmail.com>:
>>>> Hi folks,
>>>>
>>>> I was wondering if there's an idiom for skipping the generation of a
>>>> form completely at the top-level. This is mildly related to the
>>>> implicit return feature currently being trialled. Here's an example:
>>>> suppose I'm trying to skip over this form:
>>>>
>>>> (in-package :something-something)
>>>>
>>>> by using
>>>>
>>>> (defpsmacro in-package (x) nil)
>>>>
>>>> An in-package form then compiles to "null;"
>>>>
>>>> This spurious output may result in errors (I'm using ps to convert
>>>> my Lisp code to Actionscript).
>>>>
>>>> How about using (values) to indicate explicitly that something
>>>> doesn't have any return values?
>>>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Refactored-top-level-null-handling-for-use-in-ps-com.patch
Type: text/x-patch
Size: 3023 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20100204/65fa41a6/attachment.bin>


More information about the parenscript-devel mailing list