lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working on issue 665, how to proceed?


From: David Kastrup
Subject: Re: Working on issue 665, how to proceed?
Date: Sun, 17 Nov 2019 19:57:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> Am So., 17. Nov. 2019 um 18:13 Uhr schrieb <address@hidden>:
>>
>> > -----Oorspronkelijk bericht-----
>> > Van: David Kastrup <address@hidden>
>> > > I did use a lot of define-method, as it is easy this way to be type
>> > > save.
>> >
>> > I don't think the cost justifies the effort here.  Scheme is not intended 
>> > as a
>> > "type safe" language.
>
> What disturbs me are things like:
>
> (define-method (->number (value <boolean>))
>     (cond (value 1 (else 0)))
> )

Of course that one is wrong.  It doesn't particularly help that this
obviously is not at all used for improving type safety but instead is a
tool for promoting type laxness.

> (define-method (->number (value <number>))
>     value
> )
>
> (define-method (->number (value <string>))
>     (string->number value)
> )

Same here.

> I'd always sort the arg in procedure's body, like
>
> (define (->number arg)
>   (cond ((number? arg) arg)
>           ((boolean? arg) (if arg 1 0))
>           ((string? arg) (string->number arg))
>           (else #f)))

Actually this seems like a way to be extra sloppy.  Turning everything
into a number instead of having the caller provide what is actually
required seems suspicious.

In formatting applications, there may be some rationale for
turn-everything-into-a-string behavior.  But
turn-everything-into-a-number behavior stinks a bit.

I have to admit of only having read the mails so far and not the code wholesale.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]