[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ANN] CHICKEN 5.4.0 release candidate 2 available
From: |
felix . winkelmann |
Subject: |
Re: [ANN] CHICKEN 5.4.0 release candidate 2 available |
Date: |
Sun, 30 Jun 2024 12:37:34 +0200 |
> I also have a question about this line in the changelog: "Added support for
> embedded strings and characters in SRFI-4 vector". this seems very neat!
> But why doesn't it also work in the runtime u8vector constructor? Srfi-4
> vector literals are limited in that they can contain only other literals,
> not arbitrary expressions so I tend to not use them.
>
> #;2> #u8(1 "hello")
> #u8(1 104 101 108 108 111)
> #;3> (u8vector 1 "hello")
> Error: (u8vector-set!) bad argument type: "hello"
Literals like vectors contain <datum>s, which are not arbitrary expressions,
this is just how the language is defined. In normal vectors allowing expressions
would create ambiguities, as a vector can contain any value. For bytevectors
one could argue that this situation does not exist, but I somehow find that
it gets confusing. So consider the string-notation in literals a convience
feature,
nothing more. Generalizing this to the constructor procedure just invites type
errors and hides mistakes, I think.
felix