On Jul 28, 11:02 am, Meikel Brandmeyer <[email protected]> wrote:
> Hi,
>
> On Jul 28, 3:47 am, Rob <[email protected]> wrote:
>
> > (defmacro something [a ...]
> > (if (not (symbol? a))
> > (let [loc (get-source-location a)]
> > (throwf "file: %s line: %s a should be a symbol" (loc :file)
> > (loc :line)
> > ...
>
> > Thoughts?
>
> Is this really necessary? Just throwing an exception should look like
> this:
> #<CompilerException java.lang.IllegalArgumentException: foo was not a
> bar (source_file_and_line_number_here.clj:45)>
>
> The file and line information is shown in the CompilerException, no?
It's not necessary for simple macros, but I think it helps for fancier
ones. The line number in the CompilerException looks like it's the
line number of the macro "call" so imagine a macro like `define-class'
that has 100s of lines of code.
(define-class ; line 5
...
a-mistake ; line 300
...
>From what I'm seeing, the CompilerException points to line 5.
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---