[parenscript-devel] Warning about usage of reserved words as variable names
Vladimir Sedach
vsedach at gmail.com
Thu Jul 12 23:25:39 UTC 2007
Excellent idea. It's now in the darcs repository. Two things I would
like to add is to first differentiate when the identifier is being
used as a variable name and when it is being used as a function name
(putting an :after method on initialize-instance specialized on
js-defun doesn't seem to work), and to have the context for the
warnings and errors be available. Neither is trivial given the current
compiler implementation, so it will have to await the refactoring I
have planned for the future.
Thanks,
Vladimir
On 7/12/07, Viktor Leis <viktor.leis at googlemail.com> wrote:
> Hi,
>
> here is a piece of code that warns when a reserved keyword is used as a
> variable name. This is nice time saver for me, since IE refuses to run such
> code. Perhaps it could be included in a nicer way.
>
> Bye
>
> Viktor
>
>
> (defmethod initialize-instance :after ((var js-variable) &rest initargs)
> (declare (ignore initargs))
> (when (find (slot-value var 'value) '(abstract else instanceof switch
> boolean enum int synchronized break export interface this byte extends long
> throw case native throws catch final new transient char finally float
> package try const for private typeof continue function protected var
> debugger goto public void default if return volatile delete implements short
> while do import static with double in super class) :test #'string-equal)
> (warn "~a is a reserved word and should not be used as a variable"
> (slot-value var 'value))))
>
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
>
More information about the parenscript-devel
mailing list