Fork me on GitHub
#off-topic
<
2021-04-05
>
jaide05:04:18

Been learning Rescript as a promising production language, through some discussion a user shared this article with me https://lexi-lambda.github.io/blog/2020/01/19/no-dynamic-type-systems-are-not-inherently-more-open/. Was curious if there’s any solid counter-arguments? Seems to make sense to me overall but I don’t have a lot of experience with typed languages to begin with.

jaide05:04:59

I was able to use cljs in my first week for a production project but trying to find something the other team members are excited about with similar productivity benefits, but that’s a discussion for another time 😛

phronmophobic06:04:17

> It skirts too close to calling this a fundamental limitation of type systems, suggesting that it is not simply inconvenient but impossible to model such systems in a nominal, static type system. It's possible to write the same programs in turing complete languages regardless of whether they are statically or dynamically typed. Generally, which language is the best fit is more about how a language makes a program easy to express or how a language makes a program difficult to express. I think a more compelling argument for dynamic languages like clojure is that the tools for parsing, verification, validation, etc. are available a la carté, usually as libraries. The programmer has the flexibility to parse, verify, and validate whenever, wherever, and however they choose. Typically, statically typed languages have less flexibility. I've attempted to try Haskell multiple times and the main roadblock I've run into is that I've never been able to set up a REPL friendly dev environment. The constraints on when, where, and how types are specified make REPL driven hard! (I haven't tried lately, would love to know if things have changed.) Another argument I've heard is that the static type systems often don't express constraints that are important for a domain. The common example is that [a] -> [a] provides little value, but makes the type checker happy. In Clojure, when you express constraints, you have several options to choose from. For example, spec allows arbitrary predicates. Since I don't know Haskell that well, I'd love to hear if this argument actually holds water. This doesn't apply to all dynamically typed languages and programs, but it's more common in dynamically typed languages to program using Plain' Ol' Data. If you use a library, you don't really have to worry that it will return a data type that can't be easily passed to another library. If you want to split up your program, distribute it across a network, or simply store some intermediate results to disk, it's straightforward serialize your data. Again, I'm not particularly familiar with Haskell, so maybe Haskell makes that easy, but it's usually a pain in Java or C++. I think the static typers would argue that two different libraries are unlikely to have compatible data and that static typing would actually help you coerce comparable data types, but I'd much rather coerce a nested clojure map than a nested Java class. How does Haskell handle collecting data? If want to package A, B, and C in clojure, I can do {:a A, :b B :c C} . Would that require a new type in Haskell? If later I also wanted to provide D? What happens?

Mno13:04:41

He isn't wrong in any way I see. Im just not happy having to learn every person's implementation of whatever Login/Foo/Bar types they made. Let me just use a map. And I for one choose happiness. I did like reading this though.

Mno13:04:41

I particularly like the way he explained how to look at types. As an expression of assumptions.

asrar14:04:09

@UGFL22X0Q I think the author is a she, which in many reflects the discussions we are having. Dynamic languages make a lot of assumptions on the underlying data without validating them. This seems easier at first but as the programs grows larger especially within a team it becomes incredibly hard to reason about data across function boundaries.

Mno14:04:19

Oh my bad, didn't even read the name 😅

asrar14:04:21

Clojure to some extent helps by having immutable values and repl workflows.

asrar14:04:33

But a larger programs still would be served better by a static language, we have know this from the 80s, languages like Ada with their focus on strict type checking were designed to build programs for the military which had to be reliable and work exactly as intended.

indy12:04:27

I understand it is deathly practice to route queries from the client directly to the database. But, • Datomic has database functions which already understands the query. I don't have to parse the query before applying domain logic. • DB functions can store arbitrary transformations and validations, which can act as middlewares of sort. • Datomic's datalog is just plain old edn. So can I get away with passing datalog edn from the client directly to datomic and through my database functions I authorize and authenticate the request? Before allowing it to query or mutate the data?

emccue13:04:00

nah, not really - there is always a query you can throw your db that will bork stuff

3
emccue13:04:08

take a long time or whatever

emccue13:04:55

if its "secure" and you control entirely the machine sending the query then its the same as any other machine just connecting to the db

indy14:04:45

Hmm, but I guess only with Datomic we can even try to think of such a possibility.

dpsutton14:04:36

Oracle v Google opinion has come down in favor of Google.

manutter5114:04:31

Is that the one where Oracle tried to claim copyright violation on the Android OS or something?

jjttjj14:04:55

As I understand it, it's basically the question of if an API, (in this case Java's API, which Google copied to make Android), is copyrightable and it seems like the answer is no

dpsutton14:04:03

> To decide no more than is necessary to resolve this case, the Court assumes for argument’s sake that the copied lines can be copyrighted, and focuses on whether Google’s use of those lines was a “fair use.” Pp. 11–15.

dpsutton15:04:10

They assumed the opposite of that.

Dimitar Uzunov15:04:32

Yep, they copied headers from Apache Harmony to make Dalvik. Maybe it doesn't matter for the lawsuit but I found interesting this bit from the wikipedia article:

Sun offered a licensing deal of between US$30 and 50 million. Schmidt said Google would have paid for that license, but they were concerned that Sun had also requested some shared control of Android along with the fee.[9][10][11] Google states that they wanted more control in order to open source the language and allow third parties to take better advantage of its code;[9] Oracle states that Sun refused because Google's intention was essentially to fork Java to a Google version of the language, and to prevent it being inter-operable with other versions, an idea which was "anathema" to the "write once run anywhere" basis of the language.[12] Because of these differences of view, the negotiations failed to reach a deal and Sun refused Google a license for Java.[12]

dharrigan15:04:14

Man! That is outstanding news. I hope this lifts all the FUD over the language and the ecosystem.

dharrigan15:04:01

(and through the use of developers using APIs)