On Wednesday, February 18, 2015 at 3:35:26 AM UTC-5, Maurice Diamantini wrote: > > > Le mardi 17 février 2015 17:47:08 UTC+1, Stefan Karpinski a écrit : > > > IOBuffer is what you're looking for: > > > >The takebuf_string function really needs a new name. > > Stefan , thank you and sorry for my double post. > > I vote for generalizing the `to_s(xx)` method as the standard way for > converting something to string (à la Ruby). >
Conversion in Julia usually employs "convert" method, as in convert(Int, x) or (in Julia 0.4) the shorthand Int(x). In the case of strings, partly for historical reasons we have string(x). However, string(x) makes a string out of the printed representation of x, not out of the buffer contents in the case of IOBuffer. Further, in this case, the "takebuf_string" function (or takebuf_array) isn't just conversion, it is mutation because it empties the buffer. So, arguably it should follow the Julia convention and append a ! to the name. > > (out of subject, but as Julia already has the "!" character for mutator > function, it could also > have the "?" character for a boolean accessor :-) > > -- Maurice > > >
