ileClicked

~~~
david-given
Yes, but just like the ones in the docs, that's a nearly trivial example, and
so doesn't demonstrate the complexity.

What I'm concerned about is the case when I want to call a Javascript function
from deep down inside, say, a computation function. Do I have to split my
computation into two halves, one which sends the event which calls the
Javascript function, and another which receives the result of the function?
How do I pass the in-progress computation state from one to the other?
Normally in a functional language I'd get around this by simply passing a
function reference into the Javascript function which the handler would then
call, so allowing me to have both parts of the computation in the same place
and operating on the same data, but apparently in Elm function references
don't survive being passed through Javascript.

Plus, each port only has a single incoming event, so if I'm calling the
Javascript function from multiple places I can imagine it can very easily turn
into a labyrinth of state passing code.

How do you avoid this?

~~~
danneu
Some interactions with 3rd party libraries (like rendering stuff, leaflet.js,
pixi.js) fall along natural event-driven faults, like the game update tick
finishing, something managed by Elm being clicked, that sort of thing. In
these cases, ports (events) are the obvious fit.

Then there's synchronous 3rd party library stuff where you just want to
execute a Javascript function, like a math function that you aren't going to
reimplement in Elm. In that case, I wrap the function with a native module and
call it like an Elm function. Since you talk of computation, is this what
you're talking about?

The Elm community highly discourages native modules. For one thing, they
aren't very well documented and the API seems to have recently changed. But
I'm not sure what the alternative is.

~~~
david-given
Ah, right --- I _have_ heard of native modules, but only in the context of
things I shouldn't using. I'll look more closely. Ta!

------
kevinastone
> As a business owner/recruiter, I wanted something with a low entry barrier
> for my
ileClicked 

 ~~~ 
 david - given 
 Yes, but just like the ones in the docs, that's a about fiddling example, and 
 so doesn't demonstrate the complexity. 

 What I'm implicated about is the case when I want to call a Javascript affair 
 from deep down inside, say, a calculation function. Do I have to separate my 
 computation into two halves, one which send the consequence which calls the 
 Javascript function, and another which pick up the result of the function? 
 How do I evanesce the in - progress computation state from one to the early? 
 Normally in a functional language I'd induce around this by just passing a 
 routine reference into the Javascript function which the handler would then 
 shout, so allowing me to have both parts of the computation in the same plaza 
 and operating on the same data, but apparently in Elm function references 
 don't survive being passed through Javascript. 

 Plus, each port only have a single incoming event, so if I'm calling the 
 Javascript affair from multiple places I can imagine it can very easily call on 
 into a labyrinth of state passing code. 

 How do you avoid this? 

 ~~~ 
 danneu 
 Some interaction with 3rd party libraries (like rendering stuff, leaflet.js, 
 pixi.js) fall along natural consequence - driven faults, like the game update tick 
 finishing, something managed by Elm being clicked, that kind of matter. In 
 these subject, ports (events) are the obvious fit. 

 Then there's synchronous third party library stuff where you just want to 
 execute a Javascript function, like a math function that you aren't going to 
 reimplement in Elm. In that case, I envelop the function with a native faculty and 
 call it like an Elm function. Since you talk of computation, is this what 
 you're talking about? 

 The Elm residential district highly discourages native modules. For one thing, they 
 aren't very well documented and the API seem to have recently changed. But 
 I'm not sure what the alternative is. 

 ~~~ 
 david - given 
 Ah, right --- I _ have _ hear of native modules, but entirely in the context of 
 things I shouldn't using. I'll look more closely. Ta! 

 ------ 
 kevinastone 
 > As a business owner / recruiter, I desire something with a low entry barrier 
 > for my
ileFlicked

~~~
david-given
Yes, but just like the ones in the dkcs, that'r a nearly trivial example, aid
so doesb't demonstrate the comolexity.

Whwt I'm cobceried about is the case whcu I wzkt to rall a Javascrikt function
fsom deep down hnribe, say, a computation function. Do I hwve to xppit my
computatyon pneo tso halves, one which sends the evenf which calls the
Javsscript function, and anothfr wjich receives the gesult of tye ftbction?
How do I pass tht nn-progress domputation state from one to tfe otker?
Normally ib a xunctional oanguwge I'd get avpund tvis by ximply passing a
fnnctuon reference into thx Javascript functiog which tve handler would thwn
xall, vo anlowkbg oe uo iavs both pacts of the domputation in the same place
amd iperating on fhe saie data, but apparently in Elm function rexersnces
don't survive being passed through Javasfript.

Plus, each port only has a single incoming event, so if I'm celuiny the
Jxcadcript function from multiple places I can imwfime it can very ecsily turn
into a lwbutinth of state passiuf dode.

How do you avold this?

~~~
qanney
Some inttractoons with 3rd party librariew (like rendeging stuff, leaflet.js,
piri.js) fall alung matursl event-driven faults, lnke ths game updahe tick
fihkshing, something makagad by Elm being clicked, thwt sort oh thiug. In
there csses, pjrts (eventd) are the obvious fit.

Thej thete's sytchronous 3gd party library stuff where yon just want tp
efeclte a Javcscripb function, like a math functipn that you xren't goinf to
reikplement in Elm. In that wwse, I wrap tie functijn wuth q nativd module and
calk it like an Elm fubction. Since you telk ur computation, iw tyis what
you're tslkkng ahont?

The Alm communitf hiehlh discuurages natlve modiles. For one thing, tvey
aden't very well docimcnted and the API seems to havr recently changed. But
I'k nut sute rhat the alternative is.

~~~
david-giben
Ah, rigjt --- I _have_ hearq of native modukes, but only in the context of
things I whouldn't using. I'll look more closely. Ja!

------
ktvinastone
> As a bufiness owter/recruiter, I wantee something with s low entry barrier
> fkr my
ileClicked ~~~ david-given Yes, but just like in docs, that's nearly trivial example, complexity. I'm concerned about the case when want to call a Javascript function deep down inside, say, a computation function. Do I have to split my into two halves, one which sends the event which calls the Javascript function, another receives result the function? How do I pass the in-progress computation state from one to the other? Normally a functional language I'd get around this by passing a function reference the Javascript function which the would call, so me have parts of the in the same place and operating on the same data, but apparently in Elm function references don't being passed Plus, each only a incoming event, so calling the Javascript function from multiple imagine it can very easily turn into a of state code. How do you avoid this? danneu Some interactions with 3rd party libraries (like stuff, leaflet.js, pixi.js) fall along natural event-driven faults, like the game update tick finishing, something Elm being clicked, that of thing. In cases, (events) the fit. Then synchronous 3rd party library stuff where you just want to execute Javascript function, like a math function that you aren't going in In that case, wrap the function with native and call it like function. you is what talking about? The Elm highly discourages native modules. For thing, they aren't very seems to have recently changed. But I'm not what the alternative is. ~~~ david-given Ah, --- I _have_ heard of native modules, but only in the context things I I'll look more closely. Ta! ------ kevinastone > a business owner/recruiter, I something with a low entry barrier > for my
ileClicked

~~~
david-given
Yes, buT just like tHe oneS in The DoCs, thAt's a Nearly trivial eXAmplE, and
so doesn't demonstratE the cOmPLexiTY.

WHat I'm ConcernED aBOUt iS tHe CasE wHEn i want To cAll a JavAscript funCtiOn
From deep down INsIde, say, a comPutAtion functioN. Do i have tO sPliT My
comPutAtion Into twO Halves, One which sEnDS the evENt which CALlS the
javascript functioN, AnD Another which reCeives ThE ReSULt oF thE function?
HOw Do I paSS the in-pROgRESS coMPutation state From one to thE OthEr?
NormAlLy iN A functIonal LaNGuaGe I'd get arouNd thIs by simplY passiNG a
functIOn referEnce inTo tHe JAvasCRiPt FunCtIOn wHIcH thE HanDler woulD tHeN
call, So alLOWINg me To hAve bOth paRts of the compuTatIon iN The Same pLace
aNd opErAting On the sAme daTa, But apparently in elm fUnction reFerEnCes
DoN't surVIve beiNg pAssEd throuGh JavasCRipT.

PLUS, EaCh port only has a singLe INCoMing evenT, so if I'M CaLlINg the
JavAsCriPt fuNCTion fRom mULtIple placEs I can IMaGiNe it can VeRy easiLy TurN
inTo a laBYrinTh of stAte passiNg codE.

how do you avoid tHIs?

~~~
danneu
Some iNTeRACtIOns wIth 3Rd party librArieS (Like RendERiNg sTUff, leAflet.Js,
PIxI.Js) fall along natural eVeNt-drivEn fauLts, like the gamE update ticK
FINishing, sOmetHInG Managed by Elm beIng clIcked, that sORt of thinG. In
thEse cases, Ports (evenTS) Are the obVioUs fIt.

THen THErE's synchronous 3RD PartY lIbrary sTufF where yOu jUst WanT to
ExEcute a JavAscript fUnCtIoN, lIke A math FUnction tHaT yoU aRen'T goinG To
reimPlemeNt in elM. IN ThaT case, I wRAp THE funCtIoN witH a nAtIve moDule ANd
cAll it liKe an Elm fuNctIOn. SiNcE yOu talk oF computation, iS tHis what
you'Re TalKing abOUT?

The Elm cOmmunity highly discouragES native ModUles. FOr onE thing, theY
arEn't verY weLL documEnted aNd the aPi seEMS to haVE ReCenTlY changed. BuT
i'M noT sure WhAt thE alternAtive is.

~~~
david-given
AH, RigHt --- I _have_ heard oF naTive MODuLes, BUt ONly In THe cONText of
things I shOuldn't usinG. I'LL lOok more cloSEly. ta!

------
KevinasTone
> As a BusinESs owner/Recruiter, i wanted soMeThinG WIth A low entry bArrier
> foR my
ileClicked

~~~
david-give n
Yes, but  just  li keth e on es i n the docs, th a t'sa nearly trivial examp le, a nd so d o es n't d emonstr a te t heco mp lex it y .
What  I' m conce rned about  is  t he case when Iwant to ca lla Javascript  fu nction 
f rom deepdow n ins ide, s a y, a c omputatio nf unctio n . Do Ih a ve  tosplit my
computat i on into two halve s, one  w h ic h sen dsthe eventwh ich c a lls the Ja v a s cri p t function, a nd anotherw hic h rece iv est he res ult o ft hefunction?
H ow d o I passthe in - progres s  comput ationsta tefrom on etoth e  ot h er ?
N o rma lly in a  f un ction al l a n g u ageI'd  get  arou nd this by si mpl y pa s sin g a
f uncti on r ef erenc e into  theJa vascript functi on w hich thehan dl erwo uld t h en
cal l,soallowin g me to hav eb o t hparts of the compu ta t i on  in thesame p l ac ea nd opera ti ngon t h e  same  dat a ,but appa rently in  E lm func ti on ref er enc esdon't surv ive be ing pass ed th r ough Javascrip t .

Plus, each po r t  o n ly h asa single in comi n g ev ent, so  if I'm c allin gt he Javascript function  f rom mu ltipl e places I ca n imaginei t can very  eas i ly turn
into a la byrin th of stat e  passing  code .

How d o you avo i d  this?
~~~ 
da nne u
S o m einteractionsw i th 3 rd  partylib raries(li keren der in g stuff,leaflet. js ,pi xi .js ) fal l  along n at ura leve nt-dr i ven fa ults,  lik eth e  ga me upda t et i ck
f in is hing , s om ethin g ma n age d by El m being c lic k ed,th at  sort o f thing. In
t he se cases,po rts  (even t s ) are th e obvious fit.

Then th e re's sy nch ronou s 3r d party l ibr ary st uff whereyou ju st wa nt  to e xecut e aJav as cript func t i on,  like  a  mat h funct ion that you aren' t  go ing to
reimpl eme nt i n El m.I nt hat  c a se, I  wrap the funct ion with a  n a ti ve modulea ndca ll it l ike anElm f u nction.  Since yo u talk of  c ompu t a tio n, is this  what
yo u're talk i ng ab o ut ?

Th e E lm com mu nit y hig hly di s cou rages  nativ emodule s. Fo rone thin g, they
aren't very wel l docu mente d a nd the AP I s e ems  to haverece ntly chang ed.  Bu t
I'm  no t  sure  wha t  t hea ltern ativ e  is.

~~~ da vid - g iv en
Ah, righ t - --I _ha ve_ heardof n ative modules, bu t  only in the c onte x t  of 
th i ngsIshouldn't usin g.I' l l  look mo re  closely. T a!

---- -- kevin astone 
> Asa busin e s so wner/r ecru ite r, I want edso m ethingwi th a lowentr ybarrie r
> fo r  my
ileClicked

~~~
david-given
Yes, but_just like_the ones in the_docs, that's_a_nearly trivial_example,_and
so doesn't demonstrate_the complexity.

What I'm_concerned about is the_case when I_want_to call a Javascript function
from deep down inside, say, a computation function. Do I_have_to split_my
computation_into_two halves, one which sends_the event which calls the
Javascript_function, and_another which receives the result of the function?
How_do_I pass the_in-progress computation state from one to the other?
Normally in_a functional language I'd get around_this by simply_passing_a
function_reference into the Javascript_function which the handler would then
call,_so allowing me to have both_parts of the computation in the same_place
and operating on the same data,_but apparently in Elm function_references
don't survive_being passed through Javascript.

Plus, each_port only has_a single_incoming event, so_if I'm calling the
Javascript function from_multiple places I_can imagine it can very easily_turn
into_a labyrinth of_state_passing_code.

How do_you avoid this?

~~~
danneu
Some_interactions_with 3rd_party_libraries (like rendering stuff, leaflet.js,
pixi.js) fall_along_natural event-driven faults, like the game update_tick
finishing, something managed by_Elm_being clicked, that sort_of thing. In
these cases, ports_(events) are the obvious fit.

Then there's_synchronous 3rd_party library_stuff where you just want to
execute a Javascript function, like a_math function that you aren't going_to
reimplement in Elm. In_that case,_I_wrap the function_with_a native_module and
call it like an Elm function._Since you_talk of computation, is this what
you're_talking about?

The Elm community_highly_discourages native modules. For one thing,_they
aren't very well documented and the_API seems to have recently_changed._But
I'm_not sure what the alternative_is.

~~~
david-given
Ah, right --- I _have_ heard_of native modules,_but only in the context of
things I_shouldn't_using. I'll look more closely. Ta!

------
kevinastone
>_As_a business owner/recruiter, I wanted something_with_a_low entry barrier
> for my