Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Common Lisp had precompiled printing/formatting for ever: FORMAT. E.g. FORMAT is a macro.


And Idris even enables a type-safe version: https://www.youtube.com/watch?v=fVBck2Zngjo

So if you mismatch the types you'll get a compile time error instead of a run time error.


That's pretty cool. Looking for the text version of it led me to another one more accessible to average programmer:

http://www.codeproject.com/Articles/159910/Extremely-Efficie...


F# also supports a typesafe printf format notation.

http://fsharpforfunandprofit.com/posts/printf/


To be clear, FORMAT is a function possibly with an associated compiler macro to expand constant format strings into more efficient code inline.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: