On Sun, 18 Sep 2016, Sven Schreiber wrote:
> * envisage some syntax so that you have a pre-cooked set of
"sensible"
> choices via a multi-argument "print" _function_, as in
>
> print("hi:", stringvar, "!, you are the", n, "-th person
I've met!")
>
> which would also have the advantage of handling expressions natively.
>
> In this example, the idea would be that if "n" is an integer, we
> automatically apply "%d", otherwise we go for "%g", etcetera
etcetera.
Exactly. The only thing I don't quite understand is why does it have to be a
function instead of a command (or both). Ok, famously Python's most obvious
change from 2 to 3 was that 'print' became a function, too. But in the hansl
context, what's the rationale? Extending the print command would seem more
intuitive from a user's point of view. Or to put it differently: Otherwise
why allow the current 'print' command if functions are so much better?
I can see two reasons: (1) this way, you leave the print command untouched
in the interest of backward compatibility (2) we have a much better
apparatus for parsing arguments to functions than commands, and
implementation would be IMO much easier.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------