Check out a free preview of the full Hardcore Functional Programming in JavaScript, v2 course
The "Adding Syntax vs Generalized Solutions" Lesson is part of the full, Hardcore Functional Programming in JavaScript, v2 course featured in this preview video. Here's what you'd learn in this lesson:
Brian recommends using the Either type instead of exploring specific syntax that only covers one unique way of using the type.
Transcript from the "Adding Syntax vs Generalized Solutions" Lesson
[00:00:00]
>> There's that question mark operator like optional chaining or whatever that's coming out soon.
>> I haven't heard of that one.
>> [LAUGH]
>> So, can we just sort of forget about this either type now we have that?
>> Yeah, that is a really good good point and I'm glad we're able to repeat this for the audience and the video is that the fact is, that is one specific syntax or on a specific implementation or one quality.
[00:00:28]
One way to use either, and it's built in a syntax. And what we're finding with syntax like that is that we could learn how to use these things in general and build a syntax that works with whatever all of them. We keep specializing and fixing to one specific thing and then it adds to syntax noise and learning, taxes.
[00:00:52]
And I'd much prefer staying general and just working with these types cuz you only need like, five or six functions to just do anything. And that's as we'll see before the days up like chain map fold traverse, concat like these are the things that capture almost anything you'll ever have to do.
[00:01:13]
And these these contexts these these types, they actually stack and compose themselves. So, I hesitate to adopt new syntax unless it's really going to solve a general problem. All right, lets jump in, here is our front run function, is not written as cleverly with the [LAUGH]
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops