• [^] # Re: Le but ?

    Posté par (site web personnel, Mastodon) . En réponse au journal Un print(1 + "3a"), ça nous inspire comment ?. Évalué à 3.

    En même temps, tu fais pas d'effort ;)

    with Ada.Text_IO; 
    procedure bad_add is
     function "+" (Left : Integer;
     Right : String ) return String is
     (Integer'Image (Left) & Right); 
    begin
     Ada.Text_IO.Put_Line( 1 + "3a" );
    end bad_add;

    Il faut juste lui dire comment faire :)
    Par contre, c'est pas commutatif, il faudrait aussi écrire ce que l'on fait dans l'autre sens.