|
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: conditionaly setting characteri, Richard Light | Thread | Re: conditionaly setting characteri, W. Eliot Kimber |
| Re: Scheme help..., Chris Maden | Date | Re: Scheme help..., Daniel Speck |
| Month |