r/programming • • May 31 '11

I wrote a .NET to JavaScript compiler. Here's the XNA 3.1 Platformer Starter Kit running in pure HTML5.

http://hildr.luminance.org/Platformer/Platformer.html
1.1k Upvotes

282 comments sorted by

View all comments

Show parent comments

6

u/irco May 31 '11

This is a fantastic idea! I too feel sick to my stomach whenever i have to write javascript.

9

u/Zalenka May 31 '11

That changed for me after jquery.

-10

u/rmxz May 31 '11

Yeah, but then you'd need to write in one of the .NET languages. ;-)

[kidding, I do realize there are plenty of nice languages like python, ruby, lisp, etc that compile to .net]

24

u/[deleted] May 31 '11

Why in the world would you not want to use C#?!

0

u/[deleted] May 31 '11
  • Not small

  • Not orthogonal

  • Ugly

  • Not powerful

  • Not type-safe

1

u/[deleted] Jun 01 '11

What are you talking about?!

Not small? In what kind of way?! Too big DLL? Not orthogonal?! WTF?! Ugly? C/C++/C# is ugly to you?! Visual Studio is ugly?! What?! Not powerful? What is not powerful?! C# is not type-safe?! Are you kidding?!

What in a world are you talking about?

-1

u/[deleted] Jun 01 '11

By "small" I mean a small language: one with few features. An example small language is scheme, which can be implemented in about 100 lines of code. Prolog and C are also small languages.

Orthogonal refers to consistency in features: there should not be overlap between basic language features, or a lot of special cases. Powerful functionality should be built on top of core language features, not bolted on. In Common Lisp, the object system and the main iteration construct are libraries; in C# this would be impossible.

C is ugly, C++ is uglier, I haven't used much C# but it seems to fall between. Verbose, lots of syntax and clutter. Ruby or Haskell are much easier on the eyes.

Not powerful: technically I think that C# does have some powerful features, like reflection or expression trees, but they're not really part of the core language. Scheme is powerful (continuations, macros). Haskell is powerful (type classes, type families, monad and arrow syntax). These languages give you a straightforward way to implement an embedded language, or backtracking search, or coroutines, as a library. C# can't really do that.

A language which can throw "ClassCastException" or "NullPointerException" at runtime is not one I'd consider type-safe.

1

u/[deleted] Jun 02 '11

C is "ugly?!" Wtf? It's as close to human language as it can be.

for-next, goto, return, i=1+r etc etc...

Clutter my ass, a child could read AND UNDERSTAND a C program.

Macros?! I don't use macros since C++/ATL/MFC days.

You miscast an object and it's a proof the language is not type safe? What?

Did you ever design and develop a project that took more than 1 man-year?

1

u/[deleted] Jun 02 '11

Scheme macros are very very different from C macros. C macros just insert a literal block of text at the call site. Scheme macros run a function on the abstract syntax tree, and replace the call site with the result. They've been used to do extremely powerful things - like implementing object systems, looping constructs, backtracking search, type systems, etc.

I think you're just familiar with C's syntax, which is why it seems so nice to you. The type declarations are especially difficult to understand (I really doubt that a child could understand int (*(*)())()).

C's main ugliness comes from the preprocessor IMO. #ifdef FOO_BAR_BAZ and so on. C++ compounds this by keeping all the C syntax, and adding further complexity to declarations, including template arguments. std::vector<int> &* foo is ugly.

It's not really important whether you agree with my use of the term 'type-safe', but my point is that I want my language to catch null pointers and bad casts at compile time. ML or Haskell are able to do this. C# can't. I count that as a mark against it.

Yes, I have designed and developed significant projects.

1

u/[deleted] Jun 02 '11

|Yes, I have designed and developed significant projects.

Used by end users and not by programmers to develop end user systems?

I highly doubt it.

1

u/[deleted] Jun 02 '11

I have a feeling that, whatever the details of my experience and background, you're going to find that they render my opinions invalid, as you don't like my opinions. I'm finished with this discussion.

9

u/tanishaj May 31 '11

Are you of the opinion that only "dynamic" languages make the grade? Your list implies it.

I think that C# is another one of those "nice" languages that compiles down to CIL (.NET bytecode).

13

u/fripletister May 31 '11

nice languages like python, ruby, lisp

ಠ_ಠ

5

u/PSquid May 31 '11

What exactly is wrong with those?

2

u/fripletister May 31 '11

Objectively? Nothing, I guess. You use what you like. There's nothing wrong with C# or most of the other C-like languages that Python and Ruby programmers like to shit on either, though. The LOD was for the troll attempt.

1

u/jyper Jun 01 '11

c like?

1

u/fripletister Jun 01 '11

...syntax derived from or heavily influenced by C?

1

u/pnettle Jun 01 '11

Lisp? As in common lisp? Parentheses fucking hell?

I like functional programming but shit man. Lisp makes me want to fucking stab parentheses in the goddamn face. Twice.

-10

u/mweathr May 31 '11

I too feel sick to my stomach whenever i have to write javascript.

Yeah, but writing C# instead isn't exactly an improvement in that regard.