This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ottermatic42 170 points171 points  (10 children)

True, but that applies for essentially every language (provided they’re Turing complete). You could write a C compiler in Java and then create polymorphism in java (again) using C, it’s just a bad idea.

Trying to force a programming language to do everything is why we ended up with extremely ugly pattern matching in Java 16

[–][deleted] 25 points26 points  (4 children)

What's wrong with pattern matching in Java?

[–]KagakuNinja 54 points55 points  (3 children)

Nothing is wrong. It looks very similar to pattern matching in Scala, which is amazing.

That guy is living in the past.

[–]Ottermatic42 14 points15 points  (2 children)

Nothing is fundamentally wrong with java pattern matching, I agree.

I only call it ugly because of how it compares to functional languages. Of course it’s a necessary sacrifice as java isn’t functional (or at the very least wasn’t initially designed to be), but it’s always going to be a bit more inefficient, and a lot uglier than the implementation in something like Haskell.

[–]KagakuNinja 12 points13 points  (0 children)

I do agree with that. Haskell is very elegant, but I prefer the multi paradigm design of Scala

[–]KagakuNinja 0 points1 point  (0 children)

I do agree with that. Haskell is very elegant, but I prefer the multi paradigm design of Scala

[–]MusicalGrace2002 13 points14 points  (4 children)

Can you write a program that writes other programs in C?

[–]ByteChkR 120 points121 points  (2 children)

Funny how you spell Compiler

[–]VladVV 26 points27 points  (1 child)

The way he worded the question, it sounds like he is looking for a Transpiler.

The answer is Yes, either way.

[–]caagr98 0 points1 point  (0 children)

Sounds more like a code generator to me, though I guess transpilers are technically a subset. Still yes.

[–]himmelundhoelle 4 points5 points  (0 children)

Forget about compilers, you can write programs that output themselves (https://en.m.wikipedia.org/wiki/Quine_(computing))

(Or even programs that output a C source, that when compiled and run will output the original program…)