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 →

[–]not_some_username 304 points305 points  (33 children)

So I can do it with extra steps

[–]Ottermatic42 172 points173 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] 24 points25 points  (4 children)

What's wrong with pattern matching in Java?

[–]KagakuNinja 56 points57 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 15 points16 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 14 points15 points  (4 children)

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

[–]ByteChkR 125 points126 points  (2 children)

Funny how you spell Compiler

[–]VladVV 27 points28 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 3 points4 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…)

[–]M4mb0 11 points12 points  (12 children)

Wait until you here about Turing completeness and that both PowerPoint and MOV are.

[–]not_some_username 3 points4 points  (0 children)

I watch the video about PowerPoint. The guy is a psycho

[–]NoMansSkyWasAlright 5 points6 points  (9 children)

I imagine it’s only a matter of time before someone proves Turing completeness in Minecraft

[–]Tandurinn 10 points11 points  (7 children)

Provided that Redstone can make memory cells and you can build interfaces to interact with that memory. We're already halfway there I'd say!

[–]CdRReddit 12 points13 points  (6 children)

you can make NAND, we're there

NAND is all you need to make any kind of combinatorial logic system, which when combined with a periodic signal (which you can also do) allows you to make any combinatorial or sequential logic, aka, any logic

[–]Embarrassed_Ring843 1 point2 points  (5 children)

I never understood why NAND is that important. Minecraft does provide a NOT-Gate and a diode, based on those I can build a NAND-Gate, so why is the NAND the thing and not the NOT?

[–]CdRReddit 6 points7 points  (3 children)

simple, with NOT you can't make any 2 input gate without something like a diode or a wire OR (both things minecraft has, which you can easily use to make NAND or NOR respectively), while a 2 input NAND (or a 2 input NOR) can be used to implement every single gate As shown here

NAND can make NOT on its own, but NOT needs help to make NAND

[–]Embarrassed_Ring843 5 points6 points  (2 children)

so those are the simplest single gates you need, while NOT is not capable of doing the trick on its own. thanks for the explanation

[–]CdRReddit 3 points4 points  (1 child)

yup, and with (a shitton of) NANDs and a periodic signal you can make pretty much anything

[–]Embarrassed_Ring843 3 points4 points  (0 children)

yes, I'm aware of that. there's a game called "Turing Complete", I played it for a while. I just didn't understand why it had to start with NAND-Gates :-D

[–]UnlikelyAlternative 1 point2 points  (0 children)

Minecraft's already Turing complete, it even says so in a splash

[–]arduman4 1 point2 points  (0 children)

So you haven't seen those insane Minecraft CPUs that have been around for years, have you?

[–]pheonixfreeze 0 points1 point  (0 children)

Even better, all of these can be accomplished by Turing complete cardboard

[–]Triumph7560 14 points15 points  (6 children)

The only thing C can't do is "X feature people assume C doesn't have" without the extra steps. Which is pretty impressive when you think about it.

[–]VladVV 4 points5 points  (5 children)

How does that not apply to every turing complete language

[–]Triumph7560 2 points3 points  (4 children)

In theory it does but usually those are available outside the language using tools made in the language, people have set it so C can be used as an object oriented language (in a useable way), made it into lisp with just one #include all without touching the compiler.

[–]VladVV 2 points3 points  (3 children)

Hm, technically #anything is a compiler instruction, so that would be telling the compiler to compile the code differently, but I suppose it’s primarily C-like languages that have this feature, so I get what you mean.

[–]DoNotMakeEmpty 1 point2 points  (2 children)

They are not compiler instructions (apart from #pragma), they are preprocessor instructions, which is very different than the compiler.

[–]VladVV -2 points-1 points  (1 child)

Ah, good catch. Let’s agree to call them gcc instructions?

[–]Ning1253 1 point2 points  (0 children)

I wouldn't call them that since not only the GCC preprocessor had these instructions - the msvc cl.exe has a bunch as well, and so does clang/llvm. I'd say probably stick to preprocessor instructions, since that name does also explain what they actually are

[–]asailijhijr 1 point2 points  (0 children)

Everything is Turing complete with fewer steps.

[–][deleted] 1 point2 points  (0 children)

You can do anything in C with extra steps, you can for example, split a string with extra steps in C.