Re: conditionaly setting characteristics

Subject: Re: conditionaly setting characteristics
From: Chris Maden <crism@xxxxxxx>
Date: Tue, 24 Feb 1998 13:34:12 -0500
[Richard Light]
> This can give rise to some strange logic - I don't think that you
> can test for (attribute-string) returning #t as you do, since it
> only returns #f or a string.

I thought someone else would comment on this, but...

Clause 8.2.2 of DSSSL says: "All values count as true in [a
conditional test] except for #f."  This leads to overloaded, but
natural appearing, syntax like

(if foo
    foo
    "")

where foo is the result of (attribute-string ...) or some other
something-or-#f procedure.

This is a dangerous habit to get into, though, because nodal
procedures often return an empty nodelist, not #f, if the target isn't
found, necessitating

(if (node-list-empty? foo)
    some-default
    foo)

-Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • conditionaly setting characteristics
    • Charlie & Barbara Bozeman - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id OAA06929Sat, 21 Feb 1998 14:05:26 -0500 (EST)
      • Lassi A. Tuura - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id HAA21007Sun, 22 Feb 1998 07:35:04 -0500 (EST)
      • Richard Light - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id FAA15131Mon, 23 Feb 1998 05:41:42 -0500 (EST)
        • Chris Maden - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id NAA12108Tue, 24 Feb 1998 13:31:12 -0500 (EST) <=
      • <Possible follow-ups>
      • W. Eliot Kimber - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id OAA07168Sat, 21 Feb 1998 14:21:46 -0500 (EST)