News for hackers. Stuff that matters.
Re:The type system is a programmer's best friend by pipeline_peak on Saturday November 05, 2022 @12:51PM (#33483186)
Type systems cause programmers to write 300 classes no one references and many duplicates of each other.

Dynamic typing allows you to focus on what really matters, not trivial business logic OOP hierarchies that get inevitably ignored.

I feel like in app development, there’s something honest about dynamic typing. You’re focusing on the instance rather than the unnecessary model definition that again, nobody uses and redefined elsewhere anyway.

Tbh, I’ve never used a language like JS professionally. I’m sure a lot of code bases are copied and pasted messes with state dependencies and things that make it so you HAVE to focus on the type. It’s an app language, you’re just not gonna find elegance lol.

I’ve been a C# dev for a while now. I’ve just found that outside of libraries/frameworks/etc how rarely object model code actually gets reused. And I appreciate the cut to the chase aspect of that.

Insert quote about gorilla with banana in forest.

Re:The type system is a programmer's best friend by dgan on Saturday November 05, 2022 @04:02PM (#33485065)
Seems like you mix up classes, and types ... like many others in this thread
Re:The type system is a programmer's best friend by hither_shores on Saturday November 05, 2022 @04:07PM (#33485127)
Java and its consequences have been a disaster for the human race
Re:The type system is a programmer's best friend by pipeline_peak on Saturday November 05, 2022 @04:46PM (#33485513)
I don’t understand, classes are user defined types.
Re:The type system is a programmer's best friend by dgan on Saturday November 05, 2022 @06:06PM (#33486385)
that's the issue: there is no other way to create new types aside from creating a new class in mainstream languages. Those two concepts are separate, and should be treated as such. Types are not Classes, the last is just a lousy "embodiment" of the first
Re:The type system is a programmer's best friend by pipeline_peak on Saturday November 05, 2022 @07:14PM (#33486957)
Classes are composite data types, what you are referring to are primitive data types.

A class isn’t necessarily some wrapper around primitive types, they can contain data structures, other type instances, etc. Obviously that eventually leads to an end object containing a primitive, you can’t just have fancy trees of nothingness lol.

https://en.wikipedia.org/wiki/Data_type#Classification_of_da...

Re:The type system is a programmer's best friend by kaashif on Saturday November 05, 2022 @08:57PM (#33487606)
> Obviously that eventually leads to an end object containing a primitive, you can’t just have fancy trees of nothingness lol.

You absolutely can have types with only one value, e.g. a class with no members.

Then you can have a tree type composed of those nothing types, where the information is in the tree structure, not in any primitive value stored anywhere.

Re:The type system is a programmer's best friend by dgan on Sunday November 06, 2022 @08:43AM (#33492543)
Again, I was referring to user defined types (not primitive types), which are not classes.
Re:The type system is a programmer's best friend by pipeline_peak on Sunday November 06, 2022 @09:07AM (#33492757)
> A class specified by the keyword class, is a user defined type that contains both data members and member functions...

http://www.cs.fsu.edu/~cop3014p/lectures/ch8/index.html

Re:The type system is a programmer's best friend by dgan on Sunday November 06, 2022 @04:28PM (#33497419)
? Okey?

  module Example
    type mytype
    val id: mytype -> mytype
  end = struct
    type mytype = {
      position:(int * int)
    }
    type othertype = int
    let id self = self

  end
```

How many classes I have defined? Exactly zero. How many types I have defined? Definetely not zero. One of these types is secretly equivalent to a primitive type, while the other is not, and none of this is known to users of these types.

I am not sure why keep trying to show "class = type". It is wrong, those are different concepts. I don't care what c++ says