Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32224

Re: Functional Programming needs some real world use cases

From Scott Sauyet <scott@sauyet.com>
Newsgroups comp.lang.javascript
Subject Re: Functional Programming needs some real world use cases
Date 2017-01-21 01:29 +0000
Organization A noiseless patient Spider
Message-ID <o5udgu$obk$2@dont-email.me> (permalink)
References <8b2dc802-a0d2-4ae0-ba75-98ecf5989e64@googlegroups.com> <o5s3l1$ahq$1@dont-email.me> <l5p38cd873umflfgl2l2r6b50oa4kpsi5i@4ax.com>

Show all headers | View raw


John Harris wrote:
> Scott Sauyet wrote:

>   <snip>
>> Note that by this definition, no useful programs can be entirely
>> functional, since they could never take any input nor return any 
>> output.
> 
> Just like ECMAScript, the core language, then :-)

Exactly.  :-)

>> Although this is often glossed over, the main point is that side 
>> effects should be limited to a very thin shell of your system, leaving 
>> a functional core.
> 
> Are the DOM and similar environments a "thin" shell ?

No, but if you're going to write functional Javascript for a DOM 
environment, the idea would be to keep all the core data transformations, 
all the fundamental logic, together and central, and relegate your code 
that actually interacts with the DOM to the edges of your program.

In compile-to-JS languages like PureScript, this may actually be 
enforced, requiring you to use Monads to encapsulate side effects.  (I'm 
guessing; I have yet to try PureScript, but given it's close ties with 
Haskell, it seems a likely guess.)  In Javascript, you would have to 
manage this yourself.  I've seen people simply physically separate and 
comment as such the pure code and impure code.  Or it could be done via 
naming conventions, file layout conventions, whatever...

  -- Scott

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-18 20:09 -0800
  Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 20:10 +0000
    Re: Functional Programming needs some real world use cases Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-19 21:16 +0100
      Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 21:24 +0000
    Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 12:34 -0800
      Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 12:41 -0800
        Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 13:01 -0800
          Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 17:26 -0800
    Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 21:23 +0000
      Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 21:50 +0000
    Re: [Firefox]"print" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-24 01:52 +0100
      Re: [Firefox]"print" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-24 05:45 +0100
  Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-20 04:28 +0000
    Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 21:18 -0800
    Re: Functional Programming needs some real world use cases John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-20 10:22 +0000
      Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-21 01:29 +0000
    Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-21 01:15 +0000
    Re: Functional Programming needs some real world use cases "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-21 15:00 -0800
  Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-20 05:00 +0000
  Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-20 05:02 +0000

csiph-web