Conversation

Lucy [hiatus era] 𒌋𒁯

dynamic typing was a mistake
4
2
9
@lucy its somewhat acceptable in some kinds of runtime languages with a single object type
0
0
0

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@lucy typing was a mistake
1
0
0
@hj retvrn to assembly
1
0
0

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

1
0
3
@hj strong typing makes code more readible tho
1
0
1

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@lucy not really. You know what really does make code readable? Comments.
1
0
1
@hj > comments
LOOK WHO'S TALKING angrylaugh

but no strong typing does help reading code. like when you got a function that accepts certain parameters if it's typed you can lookup what the interface looks like. in js, python or lua it's just names and their type is "gofuckyourself" so the code fails at runtime until you figure out what the type is supposed to look like.

sure comments and documentation would help but we don't live in such a world sadcat
2
0
2

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@lucy hey I at least TRY to comment my code, i can't do it all the time and sometimes code changes so frequently that I have to wait for things to settle down so I can actually write documentation for it.

I've seen strongly typed unreadable code, mostly Java.

>in js, python or lua it's just names and their type is "gofuckyourself" so the code fails at runtime until you figure out what the type is supposed to look like.
https://jsdoc.app/about-getting-started

PleromaFE has lots of jsdoc. Not all of it but lots. As I said I'm doing my best, but my best isn't good enough sometimes.
1
0
1

@lucy @hj at least python has type hints that can be checked with static analysis tools

and yes, having tools to check these is a million times better than comments

1
0
1

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@lucy but yeah, JS does kinda force you into "console-log-driven-development", where you put console.log(thing) everywhere to check what is going on there (and sometimes `debugger` statements but those are quite annoying)
0
0
0

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@mia @lucy there are static analysis tools for js as well https://ternjs.net/ as well as using typescript as an analisys tool instead of compiler.

>and yes, having tools to check these is a million times better than comments

i strongly disagree - i'd rather have a ghost of programmer past explain things to me about code in a human language than having to decypher what the fuck code analisys beeps and boops mean.

most of the time (java, typescript) those tools just tell you "you're wrong" and that's it - no explanation. Even worse with typescript because handwritten types can be wrong themselves with no consequence in runtime
1
0
1

@hj @lucy when i’m working on a python project using kdevelop or some other capable editor/environment, it’ll display the documentation (comments) in the autocomplete window when i’m about to use some API. but only if type information is available can it make reasonable suggestions and highlight type errors.

this has been really helpful in my experience. of course not all tools work that well, but they should. and there is no good reason not to at least have type hints in a big project.

2
0
0

@lucy @hj of course type hints and what will actually work can mismatch, and that’s bad. but so can comments.

1
0
0

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@mia @lucy i'm guessing type hints are basically jsdoc/javadoc? Yeah those are good to have and I try to write them when something is public api.

I'm not completely against types but I only accept fully-static completely-type-safe typing, i.e. 90% of Java (the 10% being type erasure generics) but static typing is slow, expects you to know what the final product will look like and be very diligent with your code. All of those things are terrible for proto(heheLain)typing.

Given that even java has type erasure and that generics is both a highly demanded and highly unwieldy feature I think we'll never have REAL proper static typing that is built into the code itself.
1
0
1
@hj @mia hj look at matrix
1
0
0

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@lucy @mia "woah" neo.jpg
image.png
0
2
4

Spooner Briggs, captain of the brigantine Mary Celeste flag cute__i

@mia @lucy the I see two major problems and both of them stem from the fact that types are enforced while stuff like jsdoc ain't.

Types create second source of truth (first one being code itself) and it instantly becomes a massive pain in the ass to maintain types to accurately reflect reality, especially when it comes to all the potential cases that do not happen (yet).

The enforcement creates the "types can't be wrong" mindset and the awful awful disgusting "types should be enough documentation" cargo cult.

At the end of the day, time spent writing types could have been used to write documentation instead. IMCO (in my correct opinion) :DDDD
0
0
0
@lucy I wish gradual typing was more common, it really is the best of both worlds
3
0
2
@scathach @lucy gradual typing is nice but its hard if your type system is very expressive
1
0
0
@scathach one issue with dynamic typing ig built-in is it can be difficult to compile as freestanding code. as soon as you need dynamic memory allocations it's over.
0
0
1
@scathach @lucy as soon as you have parametric types its very easy to make static type checking undecidable. julia gets away with more type-level metaprogramming than it otherwise could by virtue of being dynamically typed
1
0
1
@nemesis @lucy I'd never heard that before, do you have any links or papers?

Big part of what's scaring me about building a programming language rn is the type checker
1
0
1
@arcana @lucy Isn't cperl just perl with OO crap? I don't know anything about raku except that they wanted it to replace perl
1
0
0
@lucy dynamic typing is just static typing with one single type
0
0
0
@scathach @lucy I would recommend trying to understanding Hindley-Milner as its the canonical example of parametric polymorphism that is decidable. and conversely look at system F as an example of what not to do
1
0
3
@scathach @lucy cperl has types and stuff

Raku is a renamed Perl6
0
0
0
@nemesis @lucy I've been trying to study HIndley-Milner and the details are going a fair bit over my head, I think I need to study more elementary type theory first
1
0
1
@scathach @lucy the way they write type systems in formal papers is still a bit confusing to me
0
0
0