<sjaustirni>
Could someone explain to me why it doesn't work please?
endformationage has joined #ponylang
jemc has joined #ponylang
Praetonus has quit [Ping timeout: 248 seconds]
<sjaustirni>
Actually, I fucked up before. This is the actual MCVE: https://is.gd/u0PVtR
<slfritchie>
sjaustirni: By trying `tokens.append(t)` you're using `t`'s type, which you're not very sure about. `let tok: Token => tokens.append(tok)` puts a more specific type on `tok`.
<slfritchie>
Trying to mind-read a little bit, you have types for `Key` and `Value`, but an `Array` doesn't allow arbitrary key types. `USize` is your only key choice, see https://stdlib.ponylang.org/builtin-Array/#apply
<sjaustirni>
hmm I see I forgot about the Array thing. I'll have to rework the design a tad then. Thank you slfritchie.
Praetonus has joined #ponylang
inoas has quit [Quit: inoas]
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
milisarge has joined #ponylang
sjaustirni has quit [Quit: Leaving]
<dougmacdoug>
not sure what the ! means here-> V #any ! is not a subtype of V #any: the subtype has no constraint
<SeanTAllen>
do you have a minimal example you could share that causes it dougmacdoug ?
alxs has quit [Read error: Connection reset by peer]
alxs_ has joined #ponylang
alxs_ has quit [Client Quit]
alxs has joined #ponylang
codec1 has quit [Read error: Connection reset by peer]
<jemc>
dougmacdoug: your example works if you say that the return type of `Foo.z` is `V^` instead of `V`
<dougmacdoug>
what does that mean
<jemc>
the rule of thumb to remember here is: when your return type is `iso` and `trn`, you almost always want `iso^` or `trn^`, where the `^` means "ephemeral", implying that you're returning a reference and not holding onto it yourself
<dougmacdoug>
^
<jemc>
the `!` means "alias of"
<jemc>
one moment and I'll pull up some reading material for you
<SeanTAllen>
dougmacdoug: have you read "Bang, Hat, Pow in Pony" ?
<jemc>
but the reason I mention `iso` and `trn` here is because you have no constraints on the `V` type parameter, so you have to account for it being any cap, including `iso` or `trn`
<dougmacdoug>
I didnt think i needed to do that with val types.. even if i make everything exclicitly val i get the same error
<jemc>
dougmacdoug: if you know you want `V` to be `val`, you need to constrain it as such
<jemc>
`fun bar[V: Any val]`
<dougmacdoug>
I had already tried that using fun bar[V: V val] but that didnt work but when I changed to fun bar[V: Any val] it worked
<dougmacdoug>
feels a bit like mashing all the buttons playing a video game.. :(
<dougmacdoug>
well, thanks for the help.. i'm compiling now..
<SeanTAllen>
that can happen until you hit the problem enough times and start to understand where its coming from. natural part of the process. i think we have all gone through it.
<dougmacdoug>
been working very heavy with generics and tuple types (which don't always play nice in generics) .. but making forward progress.
<dougmacdoug>
appreciate all the help herre
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
sjaustirni has joined #ponylang
<sjaustirni>
how would one get a heterogenous array/list/any data structure at all? (And yes, this is a follow-up to my previous question here today)
<jemc>
the basic idea is to rewrite the compiler in pony, but the current level of progress is that we can parse the AST into a pony data structure, run some basic context-free checks, and load in other files referenced with `use` statements
<jemc>
the current work that I'm doing is trying to make a nice system to represent the links that take you from one AST to another for things like type references linking to the appropriate type, etc
<jemc>
but the intention is to make it work as a library, such that you could even write a vscode language server for pony *in pony*