Re: [racket-users] Why struct type doesn't include field names?

2019-06-15 Thread Dmitry Pavlov
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.

Re: [racket-users] Why struct type doesn't include field names?

2019-06-15 Thread Ben Greenman
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

Re: [racket-users] Why struct type doesn't include field names?

2019-06-15 Thread Sorawee Porncharoenwase
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

Re: [racket-users] Why struct type doesn't include field names?

2019-06-14 Thread Dmitry Pavlov
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;

Re: [racket-users] Why struct type doesn't include field names?

2019-06-14 Thread David Storrs
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,

Re: [racket-users] Why struct type doesn't include field names?

2019-06-14 Thread Matthew Flatt
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,

[racket-users] Why struct type doesn't include field names?

2019-06-13 Thread Sorawee Porncharoenwase
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