I have yet to see an example that can't be handled with compile time format generation and evaling function definitions.
> On Apr 13, 2014, at 2:18 PM, Dominique Orban <[email protected]> > wrote: > > I think that would be a very worthy addition though. A use case for me is to > read and write sparse matrices to file in Rutherford-Boeing and > Harwell-Boeing format. Those formats are really born out of the Fortran 77 > school. They consist in a header that gives Fortran format strings to be used > to read the integer and real data (or complex) data to follow. So we would > still need something that translates Fortran formats to C formats, and that's > another story. A band-aid solution could be to interface the C library RBio > (http://www.cise.ufl.edu/research/sparse/RBio) but a Julia implementation > would be more elegant. For what it's worth, here's my Python implementation: > https://github.com/dpo/pyorder/blob/master/pyorder/tools/hrb.py. > >> On Sunday, April 13, 2014 8:26:36 AM UTC-7, Stefan Karpinski wrote: >> Note that to match the functionality of our @printf macro, it has to handle >> different types of arguments correctly, which is non-trivial. Not saying >> it's impossible, but it isn't easy. >> >> >>> On Sat, Apr 12, 2014 at 6:08 PM, Kevin Squire <[email protected]> wrote: >>> I have a port of a BSD printf function which works at about half the speed >>> of the @printf macro. I was hoping to make it more functional/less ugly, >>> but I'll see if I can't get it into a pull request, at least, or in a >>> package if it's not accepted. >>> >>> I'll also point out Dahua's Formatting.jl package, which offers >>> python-style formatting. >>> >>> Cheers, >>> Kevin >>> >>>> On Saturday, April 12, 2014, Milan Bouchet-Valat <[email protected]> wrote: >>>>> Le samedi 12 avril 2014 à 04:11 -0700, Mike Innes a écrit : >>>>> That @sprintf is a macro sort of explains why using a run-time value >>>>> doesn't work in the same way, but it isn't really the reason since >>>>> @sprintf(fmt, val) could work in principle – it would just have to >>>>> delegate to a function if its argument isn't a compile-time string. >>>>> If using a run-time string is particularly useful to you, I'd suggest >>>>> opening an issue about this, since it appears to be missing functionality. >>>> I had argued printf() and sprintf() should be functions taking >>>> non-standard string literals, instead of being macros. Then you could also >>>> pass them a (let's say) Format object created at runtime if needed. But I >>>> didn't have a concrete use case -- maybe you have one. See >>>> https://github.com/JuliaLang/julia/issues/5747 >>>> >>>> >>>> Regards >>
