English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Arg-module: Float-Args also accept integer values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-08-09 (06:13)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Arg-module: Float-Args also accept integer values
> I don't care about the implementation-details here,
> and both ways of converting would make sense, IMHO.
> But I want to have clear why this atof-like way was choosen.
> So, it's a  design-decision-question (and one that could
> reference to a bug, if the OCaml's type-system way was,
> what initially was intended, but not implemented (for some reason).

Okay then. How about usability? Do you want your end-users to be picky
over adding a decimal point in order to provide a floating point arg?

The decimal point requirement is for the programmers, not the users;
therefore, the float_of_string design is sensible.

w.r.t the sql example, it is possible (cf. linq for C#, or one of
those pgocaml libs which does compile time checking of sql queries).