<jemc>
> does get_foo create a new pointer to Foo each time
<jemc>
it'll return a constant value - the same Foo pointer every time, because `Foo` as an expression implies `Foo.create()`, which is a primitive constructor
<jemc>
> does it require extra vtable lookups
<jemc>
yes, I believe that any time you call a method on a `trait` or `interface` table, you're hitting a vtable - but I could be wrong on that, maybe someone will correct me
<jemc>
the biggest performance issue you'll see with that snippet, is that "foo" + "bar" will allocate a new string every time you do it
<jemc>
which you'll have with both the `bar` and `foobar` method
<jemc>
if you want to measure the vtable impact, you can use the `ponybench` library to compare `bar` and `foobar`
<jemc>
since they should otherwise be pretty identical
<dougmacdoug>
yeah, foo + bar was just nonsense part.. the issue is I made some default methods on a trait and they all lookup the primitive they need then run a function.. I could solve it by copying the default code into each implementation.. so its a tradeoff
<dougmacdoug>
each implementation would then be able to call the primitive directly without doing the "get_foo" call
khan has quit [Quit: khan]
khan has joined #ponylang
<jemc>
this may be the perfect case for type parameters actually
<jemc>
dougmacdoug: type parameters are resolved at compile time, so if you know which FooProvider to use at compile time, you can pass it as a type argument
<jemc>
and then the vtable hit goes away
<dougmacdoug>
the funny thing is my actual code is already using a type parameter but this is a great idea I think I can add another type parameter for this field
<dougmacdoug>
cool.. going to try it out.. thanks!