<jemc>
SeanTAllen: I didn't think that was true...
<jemc>
for primitives that is - you definitely can't define methods on a type alias
<jemc>
yeah, this works:
<jemc>
primitive One fun add(u: I64): I64 => u + 1
<jemc>
actor Main new create(env: Env) => env.out.print((One + 1).string())
<jemc>
(prints `2`)
<jemc>
you could also define the infix operator named methods on a `trait` (and use that to "inject" them into a new `class` or `primitive`)
<jemc>
dougmacdoug, maybe that helps you? ^
<jemc>
ah, just read the rest of the backlog before the latest question - now I understand that what you basically wanted is to define those methods on a tuple, which you can't do
<dougmacdoug>
right
<jemc>
yeah, if you want to keep the lightweightedness of tuples, you'll have to use the more "functional" style
<dougmacdoug>
I've been working out a vector/linear algebra lib with tuples, for performance.. i am making progress .. but its quite verbose.. would be really nice to have infix.. also override methods always creating a none return means i need to give each method a diff name..
<jemc>
"override methods always creating a none return"?
<jemc>
ah, case methods, right
<dougmacdoug>
like add2() add3() add4().. if I do add() for each vec type I get a union return .. anyway, i'll just keep chipping away and get more familiar with the language
<jemc>
case methods are definitely a little rough around the edges when it comes to being truly useful
<jemc>
especially if you're interested mainly in performance, I'd stick to using different method names for now, as you're doing
<dougmacdoug>
yeah theres a comment in the tutorial that the compiler doesnt do an exhaustive search so even if you cover every case you still get union none
<jemc>
we've got a couple new features coming down the pipeline (they've cleared the RFC process, and are ready to implement) that would give you something similar to case methods, but as a zero-cost abstraction that should also be able to get rid of the union / None return issue
<dougmacdoug>
yes I think stack tuples will be far better than making classes but it will require more typing :p
<jemc>
still won't be able to define methods on tuples, but you can have a better solution than case methods for methods-with-the-same-name-taking-different-arguments
jemc has quit [Ping timeout: 240 seconds]
dougmacdoug has quit [Read error: Connection reset by peer]
_whitelogger has joined #ponylang
dougmacdoug has joined #ponylang
graaff has joined #ponylang
amclain has quit [Quit: Leaving]
dougmacdoug has quit [Ping timeout: 240 seconds]
TonyLo has joined #ponylang
Bombe has quit [Ping timeout: 240 seconds]
Bombe has joined #ponylang
_whitelogger has joined #ponylang
dougmacdoug has joined #ponylang
aav has joined #ponylang
jemc has joined #ponylang
jemc has quit [Ping timeout: 255 seconds]
TonyLo has quit [Ping timeout: 240 seconds]
jemc has joined #ponylang
chetkhatri has joined #ponylang
<chetkhatri>
Hello All, I am chetan from INDIA.
jemc has quit [Ping timeout: 256 seconds]
jemc has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
TonyLo has joined #ponylang
<dougmacdoug>
do infix ops work on primitives or only the builtin primitives
<SeanTAllen>
are you having a problem getting something to work dougmacdoug ?
<dougmacdoug>
no but i had named some funs on primitive infix names and I was concerned it might be an issue
<dougmacdoug>
probably just confusing myself by browsing the builtin package
graaff has quit [Quit: Leaving]
chetkhatri has quit [Ping timeout: 260 seconds]
Matthias247 has quit [Read error: Connection reset by peer]
Ghostwheel11 has joined #ponylang
Ghostwheel11 has quit [Ping timeout: 260 seconds]
dougmacdoug_ has joined #ponylang
dougmacdoug has quit [Ping timeout: 260 seconds]
TonyLo has quit [Ping timeout: 240 seconds]
dougmacdoug has joined #ponylang
dougmacdoug_ has quit [Ping timeout: 252 seconds]
TonyLo has joined #ponylang
prettyvanilla_ has joined #ponylang
prettyvanilla has quit [Ping timeout: 258 seconds]
ivan has left #ponylang [#ponylang]
prettyvanilla has joined #ponylang
prettyvanilla_ has quit [Ping timeout: 260 seconds]