io:format/1

Luke Gorrie luke@REDACTED
Tue Dec 4 16:04:46 CET 2001


Hej,

In the 'io' module we have:

  format(Format) ->
          format(Format, []).

But wouldn't it be better to have

  format(String) ->
          format("~s", [String]).

I ask because we just found a bug in some code that was something like

  print_prompt(Prompt) ->
          io:format(Prompt).

and we called it with a prompt containing a ~ and it crashed..

Before answering have a read of http://hispahack.ccc.de/en/mi019en.htm :-)

Cheers,
Luke




More information about the erlang-questions mailing list