jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
Praetonus has quit [Quit: Leaving]
mahmudov has quit [Ping timeout: 260 seconds]
jemc has quit [Ping timeout: 264 seconds]
jemc has joined #ponylang
jmiven_ has joined #ponylang
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
jmiven__ has joined #ponylang
jmiven__ has quit [Client Quit]
jmiven__ has joined #ponylang
jmiven_ has quit [Quit: co'o]
jmiven_ has joined #ponylang
jmiven has quit [Ping timeout: 276 seconds]
jmiven_ is now known as jmiven
jmiven__ has quit [Ping timeout: 248 seconds]
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
jmiven_ has joined #ponylang
jmiven has quit [Ping timeout: 276 seconds]
jmiven_ is now known as jmiven
jemc has quit [Ping timeout: 276 seconds]
dougmacdoug has quit [Quit: dougmacdoug]
jemc has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
salDesk has quit [Quit: Leaving]
jemc has quit [Ping timeout: 260 seconds]
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
jemc has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
nicks has joined #ponylang
jemc has joined #ponylang
nicks has quit [Quit: Page closed]
mahmudov has joined #ponylang
user10032 has joined #ponylang
user10032 has quit [Remote host closed the connection]
jemc has quit [Ping timeout: 276 seconds]
khan has quit [Ping timeout: 256 seconds]
codec1 has joined #ponylang
codec2 has joined #ponylang
khan has joined #ponylang
mahmudov has quit [Ping timeout: 260 seconds]
mahmudov has joined #ponylang
inoas has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
mahsav has quit [Ping timeout: 240 seconds]
codec2 has quit [Quit: Leaving.]
mahmudov has quit [Quit: Leaving]
mahmudov has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
alxs has joined #ponylang
Praetonus has joined #ponylang
alxs has quit [Quit: Bye y'all!]
alxs has joined #ponylang
khan has quit [Quit: khan]
mahmudov has quit [Ping timeout: 248 seconds]
dougmacdoug has joined #ponylang
mahmudov has joined #ponylang
acarrico has joined #ponylang
sjaustirni has joined #ponylang
<sjaustirni> hey everyone! I am having troubles with matching a (Type | None) variable
<sjaustirni> here's a minimal example
<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]
<dougmacdoug> took some work
<dougmacdoug> looks like i didnt clean it all the way tho..
<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
<SeanTAllen> Its one of the reference capabilities resources: https://www.ponylang.org/learn/#reference-capabilities-resources
<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)
<sjaustirni> I have posted this question on SO as well, so if you're on SO, you can answer it there as well: https://stackoverflow.com/questions/48588594/heterogeneous-structure-in-pony
<SeanTAllen> I dont have a SO account so I cant answer there
<sjaustirni> that is no problem at all :D If you know how to solve it, just please let me know here on IRC
<sjaustirni> what is the Pony idiomatic way of doing this?
<SeanTAllen> sjaustirni: List.append takes a sequence
<SeanTAllen> seq: (ReadSeq[A] & ReadElement[A^]),
<SeanTAllen> String does not fulfull that
<jemc> sjaustirni: what you want is to call `push`, not `append`
<SeanTAllen> what are you trying to do?
<SeanTAllen> right
<SeanTAllen> i was about to say, i think you want push
<jemc> (sorry to interrupt :)
<SeanTAllen> its ok jemc
<SeanTAllen> note the method documentation on `append`: Append len elements from a sequence, starting from the given offset.
<SeanTAllen> as compared to `push`: Adds a value to the tail of the list.
<SeanTAllen> the same applies to Array and the corresponding methods there
<sjaustirni> oh, yes, it works with push. I don't know why I wrote append there
<sjaustirni> thank you both
<SeanTAllen> also, sjaustirni
<SeanTAllen> the error message you posted on SO is incomplete
<SeanTAllen> the end of the error message explains the problem
<sjaustirni> oh, I see
<sjaustirni> I am so spoiled by Rust
<sjaustirni> in Rust the error is usually in the first compiler complaint
<SeanTAllen> the parameter is a ReadSeq
<SeanTAllen> you provided a String
<SeanTAllen> which is not a read seq
<SeanTAllen> which was the message
<SeanTAllen> then it detailed all the ways that String didnt fulfill ReadSeq interface
<sjaustirni> hmm, I must have overlooked this part
<sjaustirni> it's a long error message after all
<sjaustirni> I'll try to do better next time
<SeanTAllen> there are many ways that String fails to be a ReadSeq
<SeanTAllen> its fine
<SeanTAllen> i mean, you thought append did something different
<SeanTAllen> so, even if the error message is clear
<SeanTAllen> your expectation would make it confusing
<SeanTAllen> there's nothing wrong with that
<SeanTAllen> we all do that
<SeanTAllen> if you think append does what push does then the error while "clear" is going to be nonsensical
<SeanTAllen> @jemc: do you think those sorts of errors should start the info with the type of the supplied arg and what the parameter is?
<sjaustirni> I think I got confused with Python's append
<SeanTAllen> that could be a little confusing in the case of interfaces etc
<SeanTAllen> i like the idea in theory jemc but i imagine in practice outside of a few cases it would be difficult to get right
<jemc> SeanTAllen: basically, are you thinking the last "Info" statement attached to that error should be the first info statement?
<SeanTAllen> something like that
<SeanTAllen> but im not sure its any more clear in a lot of cases
<SeanTAllen> Something like
<SeanTAllen> You're thing is a String which is not a ReadSeq blah
<SeanTAllen> sorry im tired and not sure of the value of what im saying
<jemc> yeah, so something like "argument type is {...}" and "parameter type is {...}", each pointing to the type in the source
<SeanTAllen> something like that yea
<SeanTAllen> trying to think of what might have made it more clear to sjaustirni
<SeanTAllen> ive done what he did before and been puzzled because my expectation lead me to overlook the meaning of the error message
<SeanTAllen> and i think if it was very clear that my type was not the expected type i would have been "o right"
<SeanTAllen> and putting the types explicity right there, i think that could help
<jemc> agreed
<sjaustirni> Just my 2 cents, IDK how implementable it is at all
<sjaustirni> *i am not involved...
alxs has joined #ponylang
alxs has quit [Client Quit]
alxs has joined #ponylang
_andre has quit [Quit: leaving]
sjaustirni has quit [Quit: Leaving]
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
alxs has quit [Client Quit]
alxs has joined #ponylang
alxs has quit [Client Quit]
alxs has joined #ponylang
alxs has quit [Client Quit]
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
patroclos has joined #ponylang
patroclos has quit [Client Quit]
patroclos has joined #ponylang
alxs has quit [Client Quit]
<patroclos> hey guys, I am currently looking into makin a vscode language server for pony, is there a way to get an ast_t for a specific row:column?
alxs has joined #ponylang
<SeanTAllen> there's an --ast command to ponyc but it doesn't map back to a specific line
<SeanTAllen> there is also the expresison pass --expr while will show you compilation errors with info about the specific line etc
<Praetonus> patroclos: Currently the only way would be to walk the file AST until you reach the line you want to get to
Praetonus has quit [Quit: Leaving]
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
<patroclos> yeah, i already got to a cpp app that walks the ast tree and gives me line and column
<patroclos> so i guess i'll have to take care of the ast_t mapping myself from there
<jemc> patroclos: you may also be interested to check out this repo: https://github.com/jemc/ponycc
<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*
<jemc> just something to think about
<patroclos> thanks, i'll be checking that out