Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 Internet speed test! ×

Comment I do to an extent (Score 1) 121

While I wouldn't want to program in a pure functional, no side effect language, a good mix of differing paradigms seems to me to be the way to go. Java and .NET went overboard on the OOP, and it leads to these poor abstractions in many cases (I.e. AbstractFooProcessor), which are much better approached with some FPd

Pure functional code is super easy to reason about, though, especially asynchronous code. OOP has its role, but oftentimes you find yourself on loose footing, with its focus on always changing state. This can be addressed with good practices, which leads you down class hiearchy hell. Throwing some FP in the mix gives you (mostly) the best of both worlds.

Comment Re: Louisiana is one big sinkhole (Score 1) 305

No one has to set prices. You simply set emission standards by granting a certain number of carbon credits which can be spent to pollute. The price is determined by free trade of said credits.

Still a dumb idea, because using markets to solve environmental issues (especially global ones) is terribly inefficient and subject to abuse.

We COULD solve water quality issues with no regulation on pollutants, but by slicing up the waterways with private rights. Most people rightly see this as a horrible idea that only works on paper.

For some reason, those people seem to think it will work for carbon, though.

Comment Re:How does a company like Uber lose $$? (Score 2) 133

Their business model appears to be effectively based upon self-driving vehicles. Human drivers are just a stop-gap for bootstrapping the business, so the investors subsidize your ride to get market share now, and later they will reap the profits when they can fire all their drivers.

Comment Re: Well that makes sense (Score 1) 181

I do not understand what is hard about encapsulating code. There are no hoops. Module encapsulation just works. What am I not understanding? // readval.js
module.exports = () => 42; // other.js
const readval = require("./readval");
const otherreadval = require("someone-elses-readval");
console.log(readval());
console.log(otherreadval());

Comment Re: Well that makes sense (Score 1) 181

Re: K&R, just pretend you're at a REPL. If what you're doing would confuse a REPL, then it's not going to work as expected in JS.

That said, very little JS uses K&R for anything because it is an absolute mess when you start using inline callbacks. If you want to be a special snowflake, then you can use whatever format you like by using a var/const instead of a literal, but perhaps you should get over yourself and just do it the "normal" way.

Comment Re: Well that makes sense (Score 1) 181

Here's a quick study guide, if this is too hard to mentally map type checks:

  * if it's a degenerate value, such as null or undefined, use ===
  * if it's a scalar like a number or string, use typeof
  * if it's an object (yes an array is an object), use instanceof for classically inherited types (which includes all buit-in types), and isPrototypeOf for prototypally inherited types.

Comment Re: Accidental complexity (Score 1) 181

Tough to say. Global-everything is a valid paradigm for tiny projects. If tasked with re-doing JS, I'd think long and hard about invalidating a legitimate paradigm, even if it's a paradigm I wouldn't use. That said, until using JS, the thought would not have occurred to me that you might want that.

Slashdot Top Deals

"We learn from history that we learn nothing from history." -- George Bernard Shaw

Working...