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

Re: Substring indices everywhere? and the XS>< form



oleg@xxxxxxxxx writes:

> There are two major differences between 'substring' and the proposed
> XS>< _notation_. For one thing, 'substring' function's interface is
> written in stone: (substring str i j). All three arguments are
> required, furthermore, (<= 0 i j (string-length str)) must be #t. XS><
> is not bound by this interface; it can accept fewer arguments and
> negative indices.

Why can't we extend the substring interface?

> For another thing, substring is codified to be a procedure whose
> result is a first-class value. No such promises have been made about
> the XS>< notation.

You still haven't explained why calling this notation `substring'
would cause any problems avoided by calling it `XS><'.

> System C:
> 	(define-syntax string->number
> 	   (syntax-rules (XS><)
> 	     ((string->number (XS>< arg ...))
> 		(substring->number arg ...))
> 	     ((string->number arg ...) (r5rs-string->number arg ...))))
> 
> (this is just the outline. A Scheme compiler may notice the XS><
> notation and perform the above conversion without actually requiring
> string->number be a syntax. string->number may remain a normal
> procedure).

string->number *must* be a normal procedure.

> The XS>< notation also effectively removes substring indices from all
> string library procedures. Again this addresses Tom Lord's and other
> people's concern.

Using substring does the same just as well.

You had a good idea; now have the courage of your convictions to take
the next logical step!
-- 
	--Per Bothner
per@xxxxxxxxxxx   http://www.bothner.com/~per/