[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GH replacement proposal (includes a bit of Unicode)
From: |
Marius Vollmer |
Subject: |
Re: GH replacement proposal (includes a bit of Unicode) |
Date: |
Mon, 24 May 2004 20:51:04 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
Dirk Herrmann <address@hidden> writes:
> Marius Vollmer wrote:
>
>> Hmm, yes, that might make sense. However, the -1 idiom is pretty
>> much standard for this kind of interface, no?
>
> I personally don't like this kind of 'one value, several meanings' paradigm:
>
> - What, if instead of -1, you pass -2? [...]
> - Readability suffers. [...]
Yes, I agree that the -1 idiom is not self explaining, but it is well
established and people will instantly recognize it. I'd even argue
that they will expect to be able to pass -1 for a 'len' parameter and
will be annoyed when they find out that Guile doesn't allow it.
> Note that with scm_from_locale_memory there will probably be no
> readability problem either, since whoever calls
> scm_from_locale_memory must be aware of the length, such that the
> call will typically look like
>
> SCM s = scm_from_locale_memory (str, len);
>
> with "len" being hopefully some sensible name, thus leading to
> self-documenting code.
This can be had with scm_from_locale_string as well, of course. When
you write
SCM s = scm_from_locale_string (str, len);
thats just as readable, I'd say.
Soo, I'm inclined to leave it as it is...
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405