4,485 karma · joined Jun 30, 2015 (11y ago) · 2,043 submissions
comment 8y ago · link · parent
comment 8y ago · link · parent
Many FP languages do not enforce purity (OCaml, F#, Clojure). Even in Haskell, one could use IO and IORefs everywhere, the semantics fully permit writing "Java code" in Haskell. We need a culture and an understanding of what it means to write idiomatic Haskell.
EDIT: responding to your edit:
> The problem here is the inability to do functional programming. The reasons for this are technical, not cultural.
Yes. But it's not just problems with semantics, it's also the syntax, defaults and available libraries. Culture feeds into all of this, especially as the language and ecosystem evolves. I'm arguing that it does matter.
comment 8y ago · link · parent
I disagree. Java's semantics permit defining pure functions, immutable values and persistent data structures, but the "culture" is biased towards idiomatic Java not FP. The languages syntax, defaults and core libraries can make it difficult to program in an FP style. The syntax, defaults and libraries will not change while the culture persists.
comment 8y ago · link · parent
comment 8y ago · link · parent
Well-typed programs should not go wrong. Python programs can crash at runtime due to simple type errors (expected integer but got a string). A crash is a crash, from a theoretical point of view it matters not that the error is prettier than a segmentation fault. Python is not strongly typed, it just has good error messages.
comment 8y ago · link · parent
"And this is precisely what is wrong with dynamically typed languages: rather than affording the freedom to ignore types, they instead impose the bondage of restricting attention to a single type! Every single value has to be a value of that type, you have no choice! Even if in a particular situation we are absolutely certain that a particular value is, say, an integer, we have no choice but to regard it as a value of the “one true type” that is classified, not typed, as an integer."
comment 8y ago · link · parent
Haskell is now the current inspiration for many object-oriented languages like C# and Java:
http://wadler.blogspot.co.uk/2012/09/brian-goetz-on-future-o...
comment 8y ago · link · parent
C libraries are often transitive dependencies of higher-level language libraries, e.g. for Haskell or Python. Using language-specific package managers often fails to properly handle such transitive dependencies.
> look up OS usage among developers
This doesn't indicate personal preference. My whole team is forced to develop on Windows at work, we would all rather use Linux, as we deploy to Linux and our tools, e.g. Git, work better on Linux. But such are the constraints of working in a corporate environment.
I use a Linux development environment for my personal projects.
comment 8y ago · link · parent
But languages do make a huge contribution. For example, Rust, Ada and Modula-3 are all much safer by defaults alone compared to C. Most Rust code sits outside unsafe blocks, so the existence of this feature does not prove there is no point to Rust.
comment 8y ago · link · parent
No. It is quite obvious to anyone rational and without a vested interest that C is no longer fit for purpose in this modern age.
> I have no idea why you've developed an irrational hatred of C
Let me guess. He's sick of patching security holes, memory leaks and crashes?
comment 8y ago · link · parent
- install a dev environment with all tools and transient dependencies with a single command
- install multiple versions of the same library and easily choose between them
- install the same version of a library but built with different compiler switches
The world of open source operating systems can accomplish all of the above (I use NixOS). And we get access to a repository of thousands of packaged tools. And we get fast Git.
I'm sorry but the general consensus is that Windows falls quite short of being a nice development environment, despite the existence of Visual Studio.
comment 8y ago · link · parent
The Elm debugger I posted above is a perfect example. Unlike your GDB example, it doesn't only work for a subset of x86 instructions or require monumental effort to implement. It's a high-level domain-specific debugger, that was simple to specify and build. For those of us that want to write high-level code with many layered abstractions, working one-word-at-a-time using GDB is simply not a great way to debug, even if it does now sometimes work backwards. We want to easily build our own debuggers.
comment 8y ago · link · parent
Here's an example functional debugger that can step forwards and backwards in time, as well as modify code at any time:
comment 8y ago · link · parent
In 2006, a big security flaw was introduced into Debian's OpenSSL by the maintainer, because he changed code that he did not fully understand. The flaw wasn't discovered until 2008:
https://www.schneier.com/blog/archives/2008/05/random_number...
comment 8y ago · link · parent
newtype ListT m a = ListT (m (Maybe (a, ListT m a)))
It is a nice simple example of an effectful streaming type.
> Also, by it's nature ListT can't stream IO
This is only true of the deprecated one, which is also misnamed. The community is rightly re-using the name for the behaviour shown above. See list-t on hackage, or the implementation that comes with Pipes.
comment 8y ago · link · parent
I didn't actually say this. I was suggesting a lazy chain of IO actions for such problems. For example, ListT a IO, instead of a regular lazy list with hidden side-effects. The Haskell types help make the distinction clear.
> Instead, your program returns a pure structure which describes how side effects should be executed
Yes exactly, the pure structure can still be computed lazily on demand, providing IO actions.
My favourite Hackage streaming library for Haskell is "streaming" and it can work exactly this way.
comment 8y ago · link · parent
Null is a value in its own right. If null is added to e.g. the type of numbers, then it had better be given meaning (i.e. semantics).
> You cannot do anything mathematically with a NULL value so it always results in a NULL output
Returning null if any input is null seems reasonable, but again this is not true with SQL SUM: SUM [1, null] = 1.
> Where is the inconsistency
You seriously cannot see an inconsistency? Are you trolling?
> It seems you want the database to automatically assume 0 for NULL
Where on earth did you get that idea? You are defending the behaviour of SQL SUM, not me! I've already told you, I don't want coercions.