But yes, this is directly related to the discussion above because with the
field name information, you can write your own accessor.
Yes it will be a way to go in Racket 2.
But for now, https://docs.racket-lang.org/struct-define/index.html might be a
good workaround for your problem.
On 6/15/19, Sorawee Porncharoenwase wrote:
> First of all, . won’t work in standard Racket because . has a special
> meaning (see
> https://docs.racket-lang.org/reference/reader.html#%28part._parse-pair%29).
The `read-cdot` parameter can change the standard meaning
First of all, . won’t work in standard Racket because . has a special
meaning (see
https://docs.racket-lang.org/reference/reader.html#%28part._parse-pair%29).
But yes, this is directly related to the discussion above because with the
field name information, you can write your own accessor.
#lang
Hello,
While we are at it: is it theoretically possible in Racket or Typed Racket (or
will be possible in Racket 2 or Typed Racket 2) to access struct fields without
repeating the name of the struct type again?
Like in C
typedef struct
{
double x;
double y;
} VeryLongStructureName;
On Thu, Jun 13, 2019 at 11:50 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:
> Hence the question: why struct type doesn’t include field names?
>
struct-plus-plus (
https://docs.racket-lang.org/struct-plus-plus/index.html#%28part._.Reflection%29)
gives you full reflection data,
At Thu, 13 Jun 2019 20:50:34 -0700, Sorawee Porncharoenwase wrote:
> Hence the question: why struct type doesn’t include field names?
It was an early design decision. There didn't seem to be a need to keep
field names, and so we left them out for simplicity. That may seem
difficult to believe,
Several struct extensions need to construct accessors unhygienically even
though the accessors can be extracted from struct types. The reason is that
there’s not enough information to establish connection between field names
and accessors.
For instance, consider struct* from racket/match.
#lang
7 matches
Mail list logo