[Top][All Lists]

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

Re: lily-guile updates and CG: "Scheme->C interface" section. (issue 491

From: dak
Subject: Re: lily-guile updates and CG: "Scheme->C interface" section. (issue 4917044)
Date: Sun, 23 Oct 2011 21:23:11 +0000

As usual, too late in the game.  Better late than never.
File Documentation/contributor/programming-work.itexi (right):
Documentation/contributor/programming-work.itexi:1871: (scm_list_p
(scm_value) && scm_value != SCM_EOL)
scm_list_p is _always_ true according to C since it is either SCM_BOOL_T
or SCM_BOOL_F, both of which are non-zero.
Documentation/contributor/programming-work.itexi:1880: since a list of
at least one member is considered as a pair.
But not every pair is a proper list.  scm_list_[ returns #t only for
proper lists, not circular lists and not dotted lists.

Still, this check is usually what one wants since it is cheap (list?
goes through the whole list with a hare/tortoise algorithm).  It just
won't catch the degenerate cases.
Documentation/contributor/programming-work.itexi:1884: interface.
As a rule of thumb, you get an scm_is_[something] for cheap predicates,
those that are likely to be inlined.  So you have scm_is_pair, but not
scm_is_list, and scm_is_eq but not scm_is_eqv or scm_is_equal.
Documentation/contributor/programming-work.itexi:1892: This should be
used instead of @code{scm_is_true} and @code{scm_is_false}
Both scm_is_true and scm_is_false compare only for equality with #f,
like if does.
Documentation/contributor/programming-work.itexi:1893: for properties
since empty lists are sometimes used to unset them.
since reading any unset property returns an empty list, and Lilypond has
the convention to interpret unset boolean properties as false.
Documentation/contributor/programming-work.itexi:1904: @node Conversion
The whole node is duplication.
File lily/ (left):
lily/ return true;
This returns true if every pair in list a is also in list b.  But list b
can contain more key-value pairs than a.  Since an alist can contain
duplicate entries (the former shadowing the latter), counting members is
not sufficient to deduce equivalence.

Also if a contains shadowed (different) entries, the test will never
turn out #t.  For example, this returns false when comparing '((#t . #t)
(#t . #f)) with itself.

If this function is indeed not used, delete this totally broken thing
that can't be easily fixed.
File lily/ (right):
lily/ // This one is used nowhere.
If it is used nowhere, it should be removed.  It is catastrophically
lily/ if (!scm_is_pair (a) || !scm_is_pair (b))
This returns false even if both alists are empty.

reply via email to

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