melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
59 stars 7 forks source link

prefix operator for printf debugging #749

Open remexre opened 1 year ago

remexre commented 1 year ago

It'd be convenient for debugging to have a prefix operator (or some other syntax) that expands like %x => unsafeTracePrint(x, __FILE__ ++ __LINE__ ++ show(x)) (not literally that for thunk-sharing, formatting, etc. reasons. (see Rust's dbg! for prior art)

krame505 commented 1 year ago

Seems reasonable, not sure what the best syntax would be. Would prefer to not just use a symbol, but I would also like to minimize the number of things we add that look like functions but aren't.