On 12 June 2014 11:06, J Luis <[email protected]> wrote:
>
> Hi, it took me a while and a good dose of swearing to figure this out
>
> julia> @printf ("%d,%d\n", 1,2)
> ERROR: @printf: first or second argument must be a format string
>
> julia> @printf("%d,%d\n", 1,2)
> 1,2
>
> The difference is only the space between the 'printf' and '('
> Does it have to be like that? And can the error message be more correct?
The issue is really with the way macros handle their arguments:
http://julia.readthedocs.org/en/latest/manual/metaprogramming/#macros
This in combination with the fact that `one(Int)` and `one (Int)` are
equivalent, but `@printf("%d", 17)` and `@printf ("%d", 17)` are not.
>From my own naive stand-point I would vouch for disallowing spaces
before the opening parenthesis for function calls a'la `one (Int)`.
This, in my opinion, is bad style anyway. But perhaps I am missing
some case where it would be useful.
Regards,
Pontus Stenetorp