jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
dubiousjim has joined #ponylang
Praetonus has quit [Quit: Leaving]
dipin has quit [Quit: dipin]
mahmudov has quit [Quit: Leaving]
mahmudov has joined #ponylang
mahmudov has quit [Ping timeout: 268 seconds]
jemc has quit [Ping timeout: 265 seconds]
jemc has joined #ponylang
nisanharamati has quit [Quit: Connection closed for inactivity]
codec1 has quit [Read error: Connection reset by peer]
khan has joined #ponylang
dipin has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
milisarge has joined #ponylang
dipin has quit [Quit: dipin]
khan has quit [Quit: khan]
khan has joined #ponylang
jemc has quit [Ping timeout: 248 seconds]
mahmudov has joined #ponylang
khan has quit [Quit: khan]
dubiousjim has quit [Quit: Textual IRC Client: www.textualapp.com]
codec1 has joined #ponylang
user10032 has joined #ponylang
khan has joined #ponylang
acarrico has quit [Ping timeout: 265 seconds]
jemc has joined #ponylang
acarrico has joined #ponylang
jemc has quit [Quit: WeeChat 1.9]
acarrico has quit [Ping timeout: 264 seconds]
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
dougmacdoug has joined #ponylang
<dougmacdoug> is there a concept of a static or const variable on a class or should those just be external primitives?
<SeanTAllen> static/const as in, "this can't be modified"?
<SeanTAllen> or some other aspect of how static/const work in various languages dougmacdoug ?
<dougmacdoug> single execution
<SeanTAllen> can you clarify "single execution"?
<dougmacdoug> so I have a class with a lambda member that will be assigned to one of several lambdas at creation.. but the 1 of many lambdas i have as lets inside the same class and it occured to me that those will be held in each instance
<dougmacdoug> like a static assignment on a java class is only executed once
<dougmacdoug> and there is only one instance of that static "member"
<SeanTAllen> im not connecting your two statements together, sorry.
<dougmacdoug> I think i stumbled across the answer just being to use a primitive as a namespace for those lambdas
<SeanTAllen> if you have a function foo on a Primitive and foo creates a lambda/object literal, and you call foo more than once, you will get more than one lambda/object literal
<SeanTAllen> you might already know this, sorry, i'm still not sure what it is you are doing.
<dougmacdoug> erff.. ok..
<SeanTAllen> "class with a lambda member that will be assigned to one of several lambdas at creation." <-- that is what i'm definitely unclear on
<SeanTAllen> do you have a bit if pseudo code?
<SeanTAllen> it sounds like, you want a singleton? only create this lambda once?
<SeanTAllen> but use it in multiple places?
<dougmacdoug> so lets say I have a member type (Foo|Bar) and I have some methods... my member var will never change after creation from foo or bar.. I have methods I want to execute.. I dont want to test for Foo|Bar each time
<dougmacdoug> so for each method I just call the lambda... I create the appropriate lambda at startup and assign it to a member var say _run.. then in my run method I just call _run()
<dougmacdoug> but the value that _run is assigned to (that lambda) I need somewhere to store only one instance of it (and there are way more than 2, just using foobar example))
<SeanTAllen> you lost me again. sorry.
<dougmacdoug> basically if Foo then _run = RunFoo
<SeanTAllen> sorry, i can't help because i don't understand what you are describing. your words are not clicking with my brain.
<SeanTAllen> if you could do some pseudo code with comments, perhaps i could follow along.
<dougmacdoug> not much in the way of comments but maybe its more clear
<SeanTAllen> are _runfoo and _runbar supposed to be doing partial application?
<dougmacdoug> no
<SeanTAllen> how then would they get the foo or bar?
<dougmacdoug> just an argument.. but the part that I am concerned with is that I have an instance of _runfoo and _runbar (lambda pointer or whatever pony thinks it is) in every instance of MyClass
<SeanTAllen> you want 1 instance, across all instances of MyClass ?
<dougmacdoug> for the pointers to those lambdas yes, then each instance of MyClass has a handle (_run) to whichever is appropriate for that instance
<SeanTAllen> i'm not sure why you say "pointer to those lambdas"
<SeanTAllen> so, if you want a single instance of the lambdas
<SeanTAllen> you need to initialize them outside of the class
<dougmacdoug> inside an instance of MyClass _runfoo and _runbar must exist as something correct?
<SeanTAllen> and pass them to each instance of the class when creating it
<SeanTAllen> further, those lambdas will have to be immutable, otherwise sharing wouldn't be safe, unless of course, you aren't going to be sharing instances of MyClass across actors.
<dougmacdoug> all immutable.. the point is if those two references _runfoo and _runbar are say 8 bytes each .. and I have 1 million instances, then i have 16M that I didnt need to have
<SeanTAllen> why do you need a lambda and not a function?
<SeanTAllen> if the lambda is immutable, then a function on a primitive seems to be all you need.
<dougmacdoug> how do I assign a primitive function
<dougmacdoug> i'm using the lambda like a function pointer.. decide once run many
<dougmacdoug> so I dont have to match inside the run() code.. aka decide many
<SeanTAllen> so
<SeanTAllen> you have 1 or more functions that have the same interface but different code that would be executed based on something that you match on at object creation?
<dougmacdoug> exactly
<SeanTAllen> ok, give me a minute
dave____ has joined #ponylang
dave____ has quit [Client Quit]
<SeanTAllen> I think this is what you want dougmacdoug: https://playground.ponylang.org/?gist=97302fee96ce683a1d327e5e06b036a7
<SeanTAllen> or slightly better perhaps for this case: https://playground.ponylang.org/?gist=1b567e93ca76a800ed2f83184a8d4a96
<dougmacdoug> cool.. exactly what i was trying to do..
<dougmacdoug> thanks!
<SeanTAllen> you're welcome. sorry that took a while
<SeanTAllen> i didn't understand what you were trying to do based on the earlier explanations.
<dougmacdoug> well, i didnt explain it very well
<SeanTAllen> we got to a good end result. that's the important part.
<SeanTAllen> that and no one lost an eye
mahmudov has quit [Remote host closed the connection]
khan has quit [Quit: khan]
khan has joined #ponylang
mahmudov has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
khan has quit [Quit: khan]
kempe has quit [*.net *.split]
j14159 has quit [*.net *.split]
cquinn has quit [*.net *.split]
jtfmumm has quit [*.net *.split]
Candle has quit [*.net *.split]
kempe has joined #ponylang
Candle has joined #ponylang
jtfmumm has joined #ponylang
cquinn has joined #ponylang
j14159 has joined #ponylang
ovidnis has joined #ponylang
_whitelogger has joined #ponylang
xcombelle has joined #ponylang
<krig> SeanTAllen: thanks for the feedback! I'll reply as soon as I'm able - have been on a flight to australia and am unable to access my mail ATM
<krig> SeanTAllen: I really appreciate it