<infinitary>
i'd have a beginner question about ref types
<SeanTAllen>
fire away infinitary
<SeanTAllen>
i might be a little slow answering as i'm watching a hockey game
<infinitary>
i'm just getting to learn Pony, am at classes. then i did a little experiment - as you can read it at https://infinitary.org/pony_diaries/ - it's about private fields. but then i realised it should not even have compiled because i did not used any 'ref' type?
<infinitary>
the wombat program of the tutorial does give an error message without the 'ref' but my 'other' that is not a ref can be messed with. not sure why
<infinitary>
(oh no rush, enjoy your game!)
<SeanTAllen>
Sorry, is there a question in there?
<infinitary>
the question is how can my bunny program compile and run, without 'other' being a 'ref'?
<infinitary>
my own field i can modify if my method is 'ref' but the 'other' i receive is not a 'ref' and yet i can modfy it. is tht correct?
<SeanTAllen>
Short answer: Because it is a `ref`
* SeanTAllen
class Bunny has `ref` as the default reftype.
<SeanTAllen>
If you want it to default to `val` then you want `class val Bunny`
<SeanTAllen>
the default reftype for any class is ref
<SeanTAllen>
you can provide a different default
<SeanTAllen>
like
<SeanTAllen>
class val Bunny for val
<SeanTAllen>
class iso Bunny for iso
<SeanTAllen>
so if you did class val Bunny
<SeanTAllen>
then any place you use Bunny without a reftype, Pony will use the default
<SeanTAllen>
Does that make sense infinitary ?
<infinitary>
yes yes thank ytou
<SeanTAllen>
you're welcome
dlowe has joined #ponylang
user10032 has quit [Quit: Leaving]
infinitary has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]