SRFI 4 lexical syntax John Cowan (06 Dec 2023 04:03 UTC)
Re: SRFI 4 lexical syntax Arthur A. Gleckler (06 Dec 2023 04:07 UTC)
Re: SRFI 4 lexical syntax John Cowan (06 Dec 2023 13:13 UTC)
Re: SRFI 4 lexical syntax Marc Feeley (07 Dec 2023 04:20 UTC)
Re: SRFI 4 lexical syntax John Cowan (07 Dec 2023 08:20 UTC)
Re: SRFI 4 lexical syntax Marc Nieper-Wißkirchen (07 Dec 2023 09:07 UTC)
Re: SRFI 4 lexical syntax Marc Feeley (07 Dec 2023 14:25 UTC)
Re: SRFI 4 lexical syntax Marc Nieper-Wißkirchen (07 Dec 2023 15:17 UTC)
Re: SRFI 4 lexical syntax Marc Feeley (07 Dec 2023 16:01 UTC)
Re: SRFI 4 lexical syntax Arthur A. Gleckler (07 Dec 2023 16:27 UTC)
Re: SRFI 4 lexical syntax Per Bothner (07 Dec 2023 17:20 UTC)

Re: SRFI 4 lexical syntax Marc Feeley 07 Dec 2023 04:20 UTC

> On Dec 6, 2023, at 8:13 AM, John Cowan <xxxxxx@ccil.org> wrote:
>
>
>
> On Tue, Dec 5, 2023 at 11:07 PM Arthur A. Gleckler <xxxxxx@speechcode.com> wrote:
>  I don't understand.  Isn't it to make it possible to put literals representing these values into one's program?  Are you looking for a purpose beyond that?
>
> The alternative view is that we should not have such literals, but simply use macros of the form (s32 1 2 15 3453) that work at expand time rather than read time. See <https://codeberg.org/scheme/r7rs/issues/109> for the most recent discussion.
>  By the way, I just checked, and Marc Feeley, the author, is still subscribed to this mailing list.
>
> I'd be surprised if he weren't.

I find it surprising that people are questioning the need for a lexical syntax for homogeneous vectors and I’m puzzled at some of the arguments given in issue 109.

For a macro like (u8 1 2 3) to be a substitute for '#u8(1 2 3) it has to appear in an evaluated position. So it can work here:

(define foo '#u8(1 2 3))   ;; equivalent to the proposed (define foo (u8 1 2 3))

But it can’t be used in a nested literal such as

(define foo '#(#u8(1 2 3) #u8(4 5 6) #u8(7 8 9)))   ;; no equivalent with “u8” macro

which is a perfectly fine representation for a literal 3x3 matrix of bytes.

And what about literals that embed u8vectors like:

(define smileys-utf8-alist
  '((#\😁 #u8(240 159 152 129))
    (#\😳 #u8(240 159 152 179))
    (#\😱 #u8(240 159 152 177))))

Moreover, if there is no external representation for u8vectors, it would not be possible to pretty-print the following code after macro-expansion:

(lambda () (u8 1 2 3))

That would be a real bummer for debugging and s-expression manipulation in general.

Finally, let’s not forget that SRFI-4 is now 25 years old! It is supported by most Scheme systems. This seems like the ideal situation for standardizing a feature! Lots of experience with the feature and broad support among Scheme systems. How much experience does anybody have with (u8 1 2 3)?

Marc