Better HN
topnewbestaskshowjobs
Log inSign up

hellofunk

9,428 karma · joined Jul 10, 2015 (11y ago) · 3,276 submissions

John Bellick, Mexico City
Submissions

comment 9y ago · link · parent

Not to mention that the JVM (via JRE I think?) needs to be packaged with your desktop Mac app if you want to deploy on the App Store.

comment 9y ago · link · parent

They don't need them. But many really really want them, and this "want" is often justified as a bonafide "need" out of concern for self-defense. In reality, guns are rarely used properly for self-defense and most deaths in a home from a gun are due to an accident or a suicide.

Gun ownership is deeply entrenched in American history and written into the constitution since centuries ago. When something is that fundamental to a culture and its government, it is unlikely to change.

Though I fail to understand why machine guns remain legal. You can't buy a grenade launcher or anti-aircraft missile system, so why other weapons of war? That's the one oddity.

Disclaimer: I have family members in the states; one of them own 15 guns.

1383.

Dynamic Languages Are Static Languages (2011)(existentialtype.wordpress.com ↗)

1 points · by hellofunk · 9y ago · discuss

comment 9y ago · link · parent

I've always like the description of C as just being "raw memory, but with syntactic sugar."

I think C is still so pervasive for 2 simple reasons (I might be wrong):

1) It's a small language. Compared to many newer languages (Swift, modern C++, old C++, Objective-C, Java), it's quite tiny. The language itself can be learned in short time. (Which is deceptive, because properly using what you have learned takes longer than a short time).

2) It's fast. It's just direct memory access, direct and explicit hardware manipulation. And whether justified or not, there is a very large portion of the developer community that remains obsessed with speed. I see it all the time, even when speed isn't not going to matter enough to justify C. I often see people going way out of their way, making their work much more time-consuming, because of their everlasting pursuit of writing the fastest damn program they possibly can.

comment 9y ago · link · parent

Generative testing is just one application of Clojure.spec. It does more than just aid in testing. It doubles as a runtime contract system, a data coercion system, and some folks are using it for compile-time checks as well (not in the testing sense, though I haven't read up on how they are doing that).

It is not a proof-like system, but outside of dependent typing, static typing does not catch value-related bugs, but Clojure.spec can. In a static type system, how easily would it be to exactly specify and guarantee that a function's second parameter is of a higher value than its first, or that a function's output is an integer between 5 and 50, etc? Clojure.spec is just predicate functions composed together to define the flow of data in a program, and those compositions can be used in a variety of ways.

comment 9y ago · link · parent

Swift, C++, Haskell (a little), Elm (more than a little)

comment 9y ago · link · parent

> I struggle to think of any benefits of dynamic typing on a reasonably sized code-base (e.g. 50k+ LOC).

And yet, it's done all the time with great results.

comment 9y ago · link · parent

That's entirely correct, and one of the tradeoffs.

However, in a statically-typed language, you must satisfy the type checker for everything, which adds development time. In reality, there might be a small percentage of functions in your code base for which errors (either compile-time or run-time) would likely crop up, yet you must pay that cost for 100% of them.

So that's really where the debate comes from.

Dynamically typed languages can get around this problem by generative testing (in Clojure's case) which allow very fine-tuned aspects of your system's requirements to be automatically tested before run-time without writing tests, which offers some of the same confidence as a compiler.

comment 9y ago · link · parent

> Pose a feature request to 10 lispers and they'll come back with 11 macros.

What a ridiculous stereotype. Clojure community typically maintains the belief that macros are the last resort for things that genuinely justify them. You really shouldn't spread hyperbole like this.

comment 9y ago · link · parent

That really means nothing. 100K+ lines of code is an arbitrary number. For that many lines of C++, a similar Clojure solution to the same problem would be a small fraction of that. And many widely-used Clojure libraries are in production all over the industry for many years.

comment 9y ago · link · parent

When you speak of contracts, are you referring to run-time contracts i.e. Racket?

comment 9y ago · link · parent

In fact, the decades-old CSP model, upon with Go and Clojure's core.async are based, outlined compile-time assurance that there are no race conditions in your multi-threading. You are correct that these two modern implementations of CSP do not go there.

comment 9y ago · link · parent

One very simple and significant cost is developer time. It simply takes less time to write code in a dynamically-typed language. You don't have a compiler to please, you don't write extra code to massage types, annotate types, etc, and most dynamically typed languages are pretty elegant (i.e. Clojure), where you can pack a lot of punch in just a few characters.

So the trade off is: static typing gives you more compile-time certainty, but at a cost of spending more time developing your code. Dynamic typing gets you to a working product or prototype typically much much faster, but with added run-time debugging.

Each has its benefits and costs.

In my experience, there is no doubt that dynamically typed languages are faster-to-production than statically-typed. This doesn't mean that I don't admire static typing, though, because most developers appreciate some degree of purity in their work.

comment 9y ago · link · parent

In my experience, the time saved from writing in a statically typed language where the compiler catches the bugs for you is made up by having to work more closely with the compiler, typically write more code (type annotations and other things) and in general spend that same time on compile-time rather than run-time bug hunting. Dynamically typed languages typically involve a lot less code, which is time gained.

That both forms of languages are popular shows that there are benefits in overall productivity to each; they are just different benefits.

comment 9y ago · link · parent

Many dynamically typed languages offer excellent runtime contract systems (Racket, Clojure) that serve as an implicit documentation at least as well as a statically-type language. Often more so, because you can express a lot of things in contracts that are not easily expressed in type systems.

comment 9y ago · link · parent

> I already have a set of practices that usually prevent relatively simple type mismatches

Care to share those practices? I also primarily work (this year, at least) in dynamically typed languages.

comment 9y ago · link · parent

There is one aspect to this debate that is worth pointing out. What about generative testing, which is possible in static or dynamically typed languages? The article mentions that testing is perhaps more important in a dynamically typed language since there is less compiler support. But for example, Clojure rolled out the very clever Clojure.spec library that allows you to precisely specify all details relating to function arguments, data structures, etc, in even more fine-tuned methodology than just types; you can specify that the second argument to a function must be larger than the first, or that a function should only return a value between 5 and 10, etc. These "specs" have the interesting property of being run-time checked or compile-time checked in the form of automatic tests, which can generate inputs based on the specs.

In such a case, the line between these two type environments narrows.

comment 9y ago · link · parent

> Thank God people are coming to their senses.

There are no senses to come to. Static and dynamic typing each have their own benefits, and there are genuine tradeoffs to choosing one over the other. That we are even having this debate in 2017 shows that the world of typing is not a "solved problem" and there are still good reasons to use one over the other for various reasons.

comment 9y ago · link · parent

Why would you say that? There are far more dynamically typed languages in widespread use than those 2!

comment 9y ago · link · parent

There are several points made about typing in another related post here yesterday:

https://news.ycombinator.com/item?id=15378800

comment 9y ago · link · parent

Yet the data in the article goes to 2014!

comment 9y ago · link · parent

Why is that?

comment 9y ago · link · parent

This is one of my favorite things to do on the train while on the way to work. I select two random passing objects out the window, and use a general assumption about the train's speed. Then I visualize these objects on a toroidal space, and after a few minutes, I draw the rest of the owl.

comment 9y ago · link · parent

I will agree that there are a lot of really smart people in the Clojure community, but that is also true in other communities. Some of the most brilliant developers I know are hard-core C++ guys.

The original point about bugs is in my opinion, regarding my comment you replied to, very similar to a discussion about code size. There are some great reads [0] that go into further depth on this issue, if you are curious.

[0] https://github.com/papers-we-love/papers-we-love/blob/master...

comment 9y ago · link · parent

Why is that hard to believe? Static typing always add some code size, even in languages with inference.

On top of that, the pervasive use of macros in lisp tend to lead to a kind of code-reuse that languages without macros lack.

Not to say that Haskell can't be concise also, just not to the same degree. And I've seen very long lines in Scala that were due to pleasing the compiler's typing.

Elm and Clojurescript offer a good contrast. Elm is written in Haskell and is not too unlike Haskell syntax and general language use. I've written in both Elm and Clojurescript and there is nearly a 2X difference in code size of Elm over Clojurescript for accomplishing similar non-trivial tasks.

Code size isn't everything, but it is important.

If you still find it that hard to believe, just try Clojure for awhile, and I think it will be clear. It's a tradeoff. When you don't have to satisfy a type checker for everything, you do write less code, that's just a matter of fact most of the time.

The question is whether the increased code size of a statically-type language over a lisp makes up for the extra developer resources and potential for bloat-related bugs. But that is of course the core of the typing debate.

comment 9y ago · link · parent

Not just the same list of authors; the article and this PDF have nearly the same verbatim wording.

comment 9y ago · link · parent

Don't be fooled by the October 2017 date of this article. There should be a 2014 in the title, since this appears to be a re-print of a prior study:

http://web.cs.ucdavis.edu/~filkov/papers/lang_github.pdf

comment 9y ago · link · parent

It really does just boil down (in my opinion) to code size. A small program is going to have fewer bugs than a large program. And Clojure programs can be quite small compared to the same programs written in other languages.

While I too am attracted to the static typing in many ways, I have found in my own experience of working in C++ full time for a few years (with some non-trivial work in Swift as well, which has quite a strict type system), and then Clojure full time for a few years, that when you measure all the other features of a language, typing alone does not make a big difference.

It's kind of like the argument some people make about how the cost of your rent or mortgage is the best indicator of your cost of living. There are so many other factors, and some of the lowest cost of living I've personally experienced has been in places with considerably higher rent than average, due to the offset of other factors.

comment 9y ago · link · parent

This article is dated October 2017 and claims to be the first large-scale evidentiary study. But I have definitely seen either this exact study or another one nearly identical, also using GitHub and also having similar results for the languages, and that was at least 1 year ago. So perhaps this article is a re-print of a prior study?

comment 9y ago · link · parent

I have read elsewhere (in many places, in fact, such as the interesting read "Out of the Tar Pit") that the frequency of bugs in a project scales proportionally to the code size. And that this has a greater influence on bugs than features of any particular language.

Clojure is an incredibly succinct language. It uses about half as many lines as Elm, 5% as many lines as C++. I love other languages, but nothing rivals Clojure in elegance. I believe this is the key reason why Clojure projects are so low on bugs -- they are much simpler to maintain, refactor, or rewrite entirely than in most other languages, so fixing problems is not the chore it can be elsewhere.

1
464748
110