guile-devel
[Top][All Lists]
Advanced

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

Argument checking in relation predicates


From: Martin Grabmueller
Subject: Argument checking in relation predicates
Date: Thu, 25 Jan 2001 23:03:11 +0100

Hello again,

the relation predicates like string>?, char<=? etc. all have a
argument checking problem, which is due to the fact that they all are
of type scm_tc7_rpsubr (if I read (and understand) the code
correctly).

These procedures all accept arbitrarily many arguments, and only check
their aguments under certain consitions.  Consider the following
examples:

  guile> (char>?)
  #t
  guile> (string>? "as")
  #t
  guile> (string>? 1)   
  #t
  guile> (string>? "foo" "bar")
  #t
  guile> (string>? "foo" 1)    
  <unnamed port>:5:1: In procedure string>? in expression (string>? "foo" 1):
  <unnamed port>:5:1: Wrong type argument in position 2 (expecting STRINGP): 1
  ABORT: (wrong-type-arg)
  guile> (string>? "foo" "bar" "zzz")
  #f
  guile> (string>? "foo" "bar" 1)    
  <unnamed port>:9:1: In procedure string>? in expression (string>? "foo" "bar" 
...):
  <unnamed port>:9:1: Wrong type argument in position 2 (expecting STRINGP): 1
  ABORT: (wrong-type-arg)
  guile> (string>? "foo" "zar" 1)
  #f

As you can see in the last example, the argument checking depends on
the actual data, e.g. whether the arguments are actually compared up
to the aronly typed paramter.

This behaviour can lead to extremely hard-to-find bugs, because error
messages can appear or not, depending on the order of the actual data.

I suspect that this problem is very hard to fix, because the logic for
these predicates is closely tied to the evaluator, so what do you
think: Is it worth fixing?

Regards,
  'Martin (a.k.a. the bothering guile bug searcher)
-- 
Martin Grabmueller              address@hidden
http://www.pintus.de/mgrabmue/  address@hidden on EFnet



reply via email to

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