Re: thoughtful feedback on SRFI 241 on Reddit
Marc Nieper-WiÃkirchen 13 Nov 2022 20:19 UTC
Am So., 13. Nov. 2022 um 19:29 Uhr schrieb Marc Nieper-Wißkirchen
<xxxxxx@gmail.com>:
[...]
> >> That said, in my opinion this is not good Scheme code since record
> >> types have been standardized. Especially in a language with dynamic
> >> typing, it is important to have strong runtime types; using general
> >> lists to model trees, however, is an example of very weak typing.
> >
> >
> > It's important to have record types, but it is not necessarily important to use them, depending on context. Indeed, CL provides mechanisms for talking about lists and vectors of known size as if they were records: see <https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node175.html#SECTION002370000000000000000>.
>
> I don't see the relevance in what CL provides. In any case, I was
> talking about what I think is good, modern Scheme code.
>
> Dedicated types instead of general vectors (which, at least, don't
> have the allocation cost of lists) also help the compiler. Because of
> the lack of static typing, the code it produces can be the better the
> more specific types it can infer.
PS: Despite it was me who suggest that we shouldn't talk about "static
Scheme" on this list, allow me to add the remark that a record type as
defined by (define-record-type address (fields name street city
postcode)) is much easier to handle by a type system (which could just
be the type system underlying the compiler's type inference) that the
type of a pair whose car is the symbol "address" and whose cdr is a
pair whose car is a string and whose cdr is a pair whose...