Doesn't using the following package solves this issue?
https://github.com/lindahua/Formatting.jl

On Monday, March 23, 2015 at 2:07:11 PM UTC+1, Milan Bouchet-Valat wrote:
>
> Le lundi 23 mars 2015 à 05:50 -0700, Daniel Carrera a écrit : 
> > Dear all, 
> > 
> > 
> > For me personally my biggest irritation with Julia is the fact that 
> > @sprintf() is a macro and not a function. That means that I am always 
> > forced to write the entire format string in one go. For example, this 
> > doesn't work: 
> > 
> > 
> > julia> fmt = "%3d" 
> > "%3d" 
> > 
> > 
> > julia> @sprintf(fmt,a) 
> > ERROR: @sprintf: first argument must be a format string 
> > 
> > 
> > 
> > 
> > 
> > If the format string is long, or if I want to generate it dynamically, 
> > this quickly becomes cumbersome and irritating. I would much rather 
> > have a traditional printf() and sprintf() function that I can use 
> > naturally: 
> > 
> > 
> > fmt = "%15s - " * repeat("  %7.4f", 17) 
> > 
> > 
> > printf(fmt * "\n", name, vals...) 
> > 
> > 
> > 
> > 
> > Yes, it is possible to work around this seemingly arbitrary 
> > limitation, but that goes against the spirit of writing code that is 
> > clear and simple. I generally like Julia because the code is clear 
> > with very little extraneous syntax, so the implementation of @sprintf 
> > sticks out like a sore thumb. 
> > 
> > 
> > Is there any hope that this might change some day? I really don't 
> > understand why we have to use a macro here. Even C/C++ can manage to 
> > have a printf function. Why can't Julia? 
> There was a discussion about this recently, but it stopped prematurely: 
> https://github.com/JuliaLang/julia/pull/9243 
>
>
> Regards 
>
>

Reply via email to