shiny uno version, Desktop IDL
Stephan Bergmann
sbergman at redhat.com
Fri Jun 22 05:24:44 PDT 2012
On 06/19/2012 11:27 AM, Bjoern Michaelsen wrote:
> On Tue, Jun 19, 2012 at 10:42:39AM +0200, Stephan Bergmann wrote:
>> On 06/14/2012 01:58 PM, Bjoern Michaelsen wrote:
>> Actually writing down the static information can have a huge benefit
>> on maintainability. (Even in static languages with type inference
>> like Haskell, where you would not actually need to write down type
>> signatures, it is common practice to nevertheless do so especially
>> for exported entities, for better documentation.) Witness gbuild:
>> we do run into cases there where a macro is called with more
>> arguments than it expects, and at least I often need to decipher
>> definitions (or worse, use "monkey see, monkey do" copy/paste) to
>> figure out what arguments, and in what order, a macro takes. I
>> would *love* to have a more statically typed machinery there...
>
> The problem with gbuild is not that it is dynamic typed, but that it is weakly
> typed (everything is a string).
While gbuild indeed only has a single basic data type (string), it does
have the notion of functions (aka macros) that take arguments, so it
does have more elaborate types, namely "string* -> string" (i.e., a
macro takes an arbitrary number of string arguments and produces a
single result string). What I was complaining about is that it does not
have more specific types like "(string, string, string) -> string"
(i.e., a macro that takes exactly three string arguments).
Literature often calls gbuild's "everything is a string" design
"type-unsafe" rather than "weakly typed" (then again, nomenclature is
certainly inconsistent in this field).
> Testing an Any to be of a type able to provide what it
> should at runtime is still a sane thing to do, and is done anyway most of the
> time.
It is the minimum of what one needs to be done, I'd say. ;) (Or I
maybe don't get what you want to say here exactly.) What I'm arguing is
that having to resort to runtime checking is needed rarely, so I
wouldn't make dynamic typing the default.
Stephan
More information about the LibreOffice
mailing list