this post was submitted on 06 Apr 2024
58 points (86.2% liked)
Programming Languages
1167 readers
5 users here now
Hello!
This is the current Lemmy equivalent of https://www.reddit.com/r/ProgrammingLanguages/.
The content and rules are the same here as they are over there. Taken directly from the /r/ProgrammingLanguages overview:
This community is dedicated to the theory, design and implementation of programming languages.
Be nice to each other. Flame wars and rants are not welcomed. Please also put some effort into your post.
This isn't the right place to ask questions such as "What language should I use for X", "what language should I learn", and "what's your favorite language". Such questions should be posted in /c/learn_programming or /c/programming.
This is the right place for posts like the following:
- "Check out this new language I've been working on!"
- "Here's a blog post on how I implemented static type checking into this compiler"
- "I want to write a compiler, where do I start?"
- "How does the Java compiler work? How does it handle forward declarations/imports/targeting multiple platforms/?"
- "How should I test my compiler? How are other compilers and interpreters like gcc, Java, and python tested?"
- "What are the pros/cons of ?"
- "Compare and contrast vs. "
- "Confused about the semantics of this language"
- "Proceedings from PLDI / OOPSLA / ICFP / "
See /r/ProgrammingLanguages for specific examples
Related online communities
- ProgLangDesign.net
- /r/ProgrammingLanguages Discord
- Lamdda the Ultimate
- Language Design Stack Exchange
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
@Windex007 @snowe
Yes. Type-inference typically *knows better than me* what the types should be.
I frequently ask the compiler what code I need to write next by leaving a gap in my implementation and letting the compiler spit out the type of the missing section.
Can you explain why you wouldn't know what a type should be?
@Windex007
lexer :: Parser LexState (Vector Int, Vector Token)
lexer = do
(positions, tokens) <- _ nextPositionedToken
...
What goes where the underscore is in the above snippet?
I've never used Haskell, so I can barely read this as-is.
But sure: I have no idea, and I expect that's your point.
You as the writer, you don't know either? What if I could understand Haskell, is there an option to communicate that information to me? Or is the argument that nobody but the compiler and god need know? That having an awareness of the types has no value?
@Windex007
> You as the writer, you don’t know either?
Not until the compiler tells me.
> Or is the argument that nobody but the compiler and god need know? That having an awareness of the types has no value?
No, I want to know, because knowing the types has value. If the compiler has inference, it can tell me, if not, it can't.
I recognize that truly functional languages are their own beasts, with tons of amazing features provided by a ton of academic backing.
I will absolutely concede that I can't speak to them with a shred of competence. I don't know about the trade-offs and relative value propositions for pretty much anything in that space, let alone specifically w/ explicit typing.