Closed markovejnovic closed 1 year ago
Thanks! Wonder what this is about…
I agree it’s a bug, not just QOL. I think the curly brace syntax for struct construction is kind of neglected—I usually don’t use it since it’s more verbose.
I can’t seem to reproduce this. In particular, this works for me:
#lang dssl2
struct Account:
let id
let type
let balance
struct customer:
let name
let bank_account
let customers = [
customer { name: 'Alice', bank_account: Account(1, 'savings', 10) },
customer { name: 'Bob', bank_account: Account(2, 'checking', 5) }
]
In your example is customer
by any chance imported from another module? That isn’t supported for… reasons.
(That was wrong. It should also work when imported.)
Sorry for not following up on this -- didn't see the notification when this was relevant...
Seems like it's my fault somewhere -- I'd close this as a non-issue.
The language does not appear to support inline struct literal construction syntax.
This statement does not work:
The following error is thrown:
However, this syntax works, throwing no errors:
Also, please observe that the following will throw an error:
That error is:
This appears to indicate that inline struct literal construction does not work. Note that class construction is also employed in this example and it does not present any issues to the interpreter.
Perhaps it would be beneficial and would be a QOL upgrade to enable inline struct construction.
Additional Information
Arch Linux, latest
7.8