I'd personally use `programWithArgs`, or just `program` and bake flags in, 
defaulting to an empty tuple or some other nil type or so that comes from 
javascript's `undefined`.  Like define init via `init () = { blah model }` 
for the 'no argument' case, that way it accepts 'undefined' from 
javascript, such as when there is no argument passed in from javascript.


On Wednesday, September 28, 2016 at 10:28:12 PM UTC-6, Bobby Priambodo 
wrote:
>
> Yeah, that’s also the conclusion I came to after some reasoning. But I 
> still think that it’s kind of confusing for first-timers in Elm; it might 
> make sense if the context was a CLI program, but I don’t think I've heard 
> it used in, say, web applications (other than feature flags). It’s great 
> that now it’s in the guide, but it was not on my first pass and left me 
> effectively confused.
>
>
> If we want to be explicit, why not something along the lines of 
> `programWithInitialValues`?
>
> On Thursday, 29 September 2016 03:22:18 UTC+7, Nick H wrote:
>>
>> I think it's pretty common to use "flag" to refer to any option passed to 
>> a program when it starts. For instance, in
>>
>> elm-make src/Main.elm --output=main.js
>>
>> the "--output=main" is often referred to as a flag, even though it is not 
>> a boolean value.
>>
>> On Wed, Sep 28, 2016 at 12:55 AM, Bobby Priambodo <[email protected]> 
>> wrote:
>>
>>> Hi! I'm building my first Elm app using the embed-to-HTML approach. I'm 
>>> already using a backend (Node.js with Hapi), and since I think 
>>> server-side-rendering is not supported anytime soon, I'm just passing the 
>>> data from the server to Elm through JS interop.
>>>
>>> I've initially used subscription ports to do it, but several days ago 
>>> Evan updated the interop part in 
>>> guide.elm-lang.org/interop/javascript.html to show how to do it with 
>>> `programWithFlags`. I remember skimming through the docs and saw that 
>>> function, but I didn't even think that it will achieve what it does. It's 
>>> kind of unintuitive that `programWithFlags` means "an app which allows 
>>> initializing model through JS", since in many programming stuff "flags" 
>>> just mean boolean values or switches.
>>>
>>> Was there any reason why it's named that way?
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to