<SeanTAllen>
error is more expensive than an match
<SeanTAllen>
assuming you got errors most of the time
<SeanTAllen>
if you rarely get an error, it will be less expensive then always going a match
<foofighterbar>
Thanks!
<foofighterbar>
For some cases, like where List.head returns an "A?", do I have a choice to do a match instead of a try block?
<foofighterbar>
Or is that the proper pattern?
<SeanTAllen>
You do not.
<SeanTAllen>
We have tried to think of a way library writers could make that optionally available but
<SeanTAllen>
there's no good way to do that
<SeanTAllen>
you'd need something like the c preprocessor to run first and select versions and implementation
<SeanTAllen>
or macros
<SeanTAllen>
i look forward to having macros someday
jemc has quit [Ping timeout: 240 seconds]
khan has quit [Ping timeout: 240 seconds]
<foofighterbar>
Makes sense, thanks for the info SeanTAllen
<foofighterbar>
I imagine there's some really interesting design tradeoffs that are required to be made, for this kind of language
<foofighterbar>
the dividing by 0 == 0 aspect is particularly interesting
mahmudov has quit [Ping timeout: 256 seconds]
milisarge has quit [Ping timeout: 248 seconds]
<foofighterbar>
So, I'm probably missing something obvious here, but I'm trying to get the value in the head of a list
<foofighterbar>
_snake.head().apply()
<foofighterbar>
Oh, so I need ? after both calls-- I was just trying it on one or the other
<foofighterbar>
why is that?
<SeanTAllen>
any method that is partial needs to have the ?
<SeanTAllen>
no spooky action at a distance
<SeanTAllen>
then you can look at the code
<SeanTAllen>
and know every place an error might come from
<SeanTAllen>
imagne for example
<SeanTAllen>
that you have
<SeanTAllen>
foo().test().blah()
<SeanTAllen>
ok
<SeanTAllen>
and right now blah() can throw an error
<SeanTAllen>
foo().test().blah()?
<SeanTAllen>
i wrap it in a try
<SeanTAllen>
now later test starts being able to throw errors as well
<SeanTAllen>
by requiring
<SeanTAllen>
foo().test()?.blah()? that change in interface will result in an API error
<SeanTAllen>
so you can consider...
<foofighterbar>
ah okay, makes sense-- so the compiler could always infer it, but this makes it easily identifiable in the code
<SeanTAllen>
do i want to handle errors from test()? differently than blah()?
<SeanTAllen>
visible is one thing
<SeanTAllen>
but the "no spooky action at a distance" when a method later becomes one that can throw errors is a very big part as well
<foofighterbar>
yeah. Because hey, the method may have already been under a try block, and so the compiler wouldn't complain if the type signature switched to ? under you-- but the logic may be off
<foofighterbar>
just started learning Pony last night, working on a little snake game
<foofighterbar>
it's a really interesting language, first time I've ever worked with capabilities like thos
<SeanTAllen>
can you email me a link or send to the mailing list?
<SeanTAllen>
sorry, i'm knee deep in working out performance in Wallaroo in the Go API where we are calling into Go from Pony.
<SeanTAllen>
And I'm exhausted and completely busy for a bit
<SeanTAllen>
if you send to mailing list though, i will take a look when i have time
<SeanTAllen>
and others could give feedback as well
<SeanTAllen>
this `let _main: Main tag`
<SeanTAllen>
Main is an actor
<SeanTAllen>
you don't need the `tag`
<SeanTAllen>
`tag` is the default for an actor
<SeanTAllen>
personally i dont like to do anything other than initialization in Main, so I'd create another actor for doing all the non intialization stuff
<foofighterbar>
*shrugs* no worries, I don't have too many questions on it, just excited to learn the language.
<foofighterbar>
I appreciate the help with the "?" questions I had, and good luck with the Go API!
<SeanTAllen>
due to problems in the implementation
<SeanTAllen>
im not sure that is what you wanted anyway
<SeanTAllen>
probably is
<SeanTAllen>
but its easy enough to turn into 1 method
<foofighterbar>
I had it in 1 method at first, but the syntax was kind of unwieldy
<SeanTAllen>
well, thats the only option you'll ahve soon
<SeanTAllen>
until someone has time to try to work out a new case functions implementation
<SeanTAllen>
that's what i see with a quick glance
<SeanTAllen>
it was a little garing for me, just because i'm used to standard library style
<SeanTAllen>
but everyone has their own style that works for me
<SeanTAllen>
didnt have time to look at logic or anything
<SeanTAllen>
anyway, i need to try and sleep
<SeanTAllen>
i'll talk to you later
<foofighterbar>
I appreciate the quick review-- go get some rest, thanks again
<foofighterbar>
I probably won't end up being super involved in the Pony community (not enough time), but I like what you're all doing here, seems really cool
khan has joined #ponylang
jemc has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
jemc has quit [Ping timeout: 264 seconds]
foofighterbar has quit [Ping timeout: 260 seconds]
milisarge has joined #ponylang
codec1 has joined #ponylang
lp has joined #ponylang
lp has quit [Client Quit]
khan has quit [Quit: khan]
mahsav has joined #ponylang
milisarge has quit [Ping timeout: 240 seconds]
mahmudov has joined #ponylang
mahmudov has quit [Client Quit]
mahmudov has joined #ponylang
jtfmumm_ has joined #ponylang
jtfmumm has quit [Ping timeout: 276 seconds]
jtfmumm_ is now known as jtfmumm
krig has quit [Ping timeout: 276 seconds]
krig has joined #ponylang
_andre has joined #ponylang
khan has joined #ponylang
woody_ has joined #ponylang
<mahmudov>
i noticed pony terminate inifite loop after 10s
<mahmudov>
just i do basic comparing to understand this.
<aturley>
mahmudov the cpp and pony code do slightly different things.
<mahmudov>
aturley just i want to understand : how should we code in pony like cpp runs
<aturley>
the pony code creates a new string every time you call `count.string()`.
<aturley>
each of these strings is allocated on the heap, and will stay there until the garbage collector runs.
<mahmudov>
yeah thats point
<aturley>
the garbage collector only runs in between behaviors.
<SeanTAllen>
and it sends it another actor "env" that will asynchronously print
<aturley>
`create` is a behavior.
<aturley>
since your code runs forever within `create`, those strings remain on the heap.
<aturley>
that's why you see memory growth in the pony example.
<aturley>
cpp handles things a bit differently.
<mahmudov>
hm aturley
<mahmudov>
i changed to
<mahmudov>
env.out.print("x")
<aturley>
without going into too many details, all of the strings that are created in the cpp program get deallocated after they are printed because they are allocated on the stack.
<mahmudov>
same results
<mahmudov>
so env.out.print("x") creates new string ?
<SeanTAllen>
mahmudov: did you read the link i sent you?
<mahmudov>
yes i am writing it so we should use timer ?
<mahmudov>
for like a code
<SeanTAllen>
ok, so... can you explain from what you read, why that is needed? you explaining what you understand, in your own words, would help me try to fill in the gaps
<mahmudov>
my understoods: in behaviours like create gc doesnt attempt to it
<mahmudov>
so heap usage can increase as a disadvantage
<SeanTAllen>
do you understand that cpp is running in a single thread and that the pony code you wrote is running multiple actors that are communicating asynchronously? and could in theory be run using more than 1 thread?
<SeanTAllen>
one could perhaps consider having to use apply() rather than () a bug
<SeanTAllen>
its certainly an intersting edge case
<SeanTAllen>
anyway, sorry have to run
<dougmacdoug>
unit tests saving my bacon on that one.. the tutorial never calls that out .. it makes perfect sense after the fact, but its not clear at all from the examples
jemc has joined #ponylang
foofighterbar has quit [Ping timeout: 240 seconds]
foofighterbar has joined #ponylang
mson has joined #ponylang
foofighterbar has quit [Ping timeout: 252 seconds]
user10032 has joined #ponylang
Praetonus has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
alxs has quit [Client Quit]
Praetonus has quit [Ping timeout: 268 seconds]
Praetonus has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
user10032 has quit [Quit: Leaving]
khan has quit [Client Quit]
khan has joined #ponylang
vaninwagen has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
khan has quit [Quit: khan]
khan has joined #ponylang
mson has quit [Quit: Connection closed for inactivity]
khan has quit [Client Quit]
khan has joined #ponylang
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
codec1 has joined #ponylang
jmiven_ has joined #ponylang
jmiven has quit [Quit: co'o]
codec1 has quit [Read error: Connection reset by peer]