Matthias247 has quit [Read error: Connection reset by peer]
jordan has joined #ponylang
jordan is now known as Guest61568
Guest61568 is now known as JordanUK
<JordanUK>
hi guys does anyone know how to return a 'this' in a function but of a ref capability? i know 'this' always returns a tag capability
<JordanUK>
for example i have a tree of nodes with - fun ref parent(): Node ref , that returns its parent node. But for the root node of the tree, I want the function to return 'itself' as a ref
<jemc>
JordanUK: I think I'm missing context in your question - the statement that `this` aways returns a `tag` capability isn't strictly true
<jemc>
could you give a full example of the code you're compiling, and the error you see?
<JordanUK>
so in my Node object i have a field _parent: Node ref; and i have a specific constructor for a Node object that is the root, in that constructor I tried to do _parent = this; but the compiler complains Node tag is not a subtype of Node Ref
<SeanTAllen>
the problem is that until an object is fully initialized, "this" is a tag.
<SeanTAllen>
you have to initialize all the fields first in your constructor
<SeanTAllen>
So JordanUK, when you call parent() on the root node, do you really want it returning itself?
<SeanTAllen>
It seems like you want `let _parent: (Node ref | None) = None` or something like that for the typ
papey_lap has quit [Quit: WeeChat 1.9]
jemc has joined #ponylang
<jemc>
JordanUK: in this case, the issue is that you're in a constructor, where not all fields have been assigned yet - in such cases, `this` will be `tag` - the error message is supposed to tell you that it would be possible if all fields were assigned by that point
<SeanTAllen>
i think we have a ticket open for that change in error message, yes jemc?
<jemc>
it's actually a regression, I think - that clarification used to exist
<jemc>
not sure how/why it disappeared
<SeanTAllen>
hmmm... i wonder how we would prevent regressions like that
bbhoss has quit [Ping timeout: 255 seconds]
bbhoss has joined #ponylang
bbhoss has joined #ponylang
bbhoss has quit [Changing host]
<jemc>
we currently test error messages (for new tests - many od tests do not test error messages), but we don't currently have a way to test the "error continuations" that provide extra info for an error
<jemc>
in ponycc I'm testing the entire error output, but in ponyc we currently do not
catern has quit [Ping timeout: 260 seconds]
JordanUK has quit [Ping timeout: 260 seconds]
catern has joined #ponylang
JordanUK has joined #ponylang
acarrico has quit [Remote host closed the connection]
<JordanUK>
ic thanks for all the help and yes i worked around this with a None type and i also understand why it has to be of a tag cap until the object is fully constructed
<jemc>
I'll try to make time this weekend to fix that error message, since it seems like a common pain point
JordanUK has quit [Quit: Page closed]
Matthias247 has joined #ponylang
_andre has quit [Quit: leaving]
Matthias247 has quit [Read error: Connection reset by peer]
joncfoo has quit [Ping timeout: 260 seconds]
jemc has quit [Ping timeout: 240 seconds]
<cquinn>
question about the files package: If I have a FilePath representing a file, what is the best way to get a FilePath to its containing directory? It seems that a FilePath.dir() or FilePath.parent() would be useful.
<cquinn>
Or is their an auth/caps problem walking up the hierarchy that way?
<SeanTAllen>
FilePath is designed to keep you constrained to that Path and below.
<SeanTAllen>
so yes to the auth/caps issue cquinn
<cquinn>
ok, cool. It just came to me as I was assembling the question :)
<cquinn>
I will keep the dir as a FilePath and the file as a String below it. Or similar.
<cquinn>
oh, hey, while I'm thinking about it. Is there a way to run ponyc without the optimizations and without debug generation? Just for quick iteration.
<SeanTAllen>
you mean, just to see if it compiles?
<cquinn>
yes, compile & run for testing out things
<cquinn>
the optimizer takes a long time, and I'm not usually debugging
<SeanTAllen>
i use pony --debug for that. not sure if what the step would be
<cquinn>
I do the same, ponyc -d, but I was just wondering if there was a way to get the fast compile without the symbols out. might be slightly faster too.