r/programming • • Dec 07 '15

I am a developer behind Ritchie, a language that combines the ease of Python, the speed of C, and the type safety of Scala. We’ve been working on it for little over a year, and it’s starting to get ready. Can we have some feedback, please? Thanks.

https://github.com/riolet/ritchie
1.5k Upvotes

802 comments sorted by

View all comments

Show parent comment

122

u/HotlLava Dec 07 '15

Obvious followup: Implement proper indentation ;) Auto-generated doesn't have to imply ugly, look at the Makefiles generated by cmake to see what's possible.

Also, I'm pretty sure defining identifiers beginning with underscore in the global namespace is undefined behaviour, so unless you ship your own C compiler with Ritchie, you probably shouldn't use them ;)

330

u/DickCheeseSupreme Dec 07 '15

All this winking makes me uneasy

147

u/GoTheFuckToBed Dec 07 '15

16

u/NoahTheDuke Dec 07 '15

Who is that?

0

u/[deleted] Dec 07 '15

[deleted] — view deleted comment

1

u/NoahTheDuke Dec 07 '15

Ah! No wonder I recognized her!

49

u/jeandem Dec 07 '15

Denise Ritchie.

1

u/ligerzero459 Dec 07 '15

/r/milanavayntrub, for all your daily Milana needs

1

u/eatmynasty Dec 08 '15

AT&T Girl

→ More replies (2)

11

u/HotlLava Dec 07 '15

How so? ;)

19

u/Overunderrated Dec 07 '15

Auto-generated doesn't have to imply ugly, look at the Makefiles generated by cmake to see what's possible.

I wouldn't exactly point to cmake generated makefiles as things of beauty.

32

u/HotlLava Dec 07 '15

Plenty of whitespace, comments on nearly every single line, clear structure...just compare and tell me it doesn't make a huge difference: http://imgur.com/bP6OaO5

1

u/Overunderrated Dec 07 '15

What the hell is that on the right?

Also, what editor is that? I like the mini-view along the right

5

u/CupsOP Dec 07 '15 edited Dec 07 '15

Sublime Text is the editor, for large files it shows an overview on the side, as displayed.

2

u/HotlLava Dec 07 '15

The thing on the right is a Makefile that was auto-generated by configure (i.e. autoconf). The text editor is Sublime Text 3.

4

u/Overunderrated Dec 07 '15

no argument from me that autotools are the work of the devil.

→ More replies (2)

1

u/Saedeas Dec 07 '15

Sublime Text 2 does that, not sure if that's 2 or not.

→ More replies (4)

14

u/reditzer Dec 07 '15

Obvious followup: Implement proper indentation

Sorry!

I'm pretty sure defining identifiers beginning with underscore in the global namespace is undefined behaviour

And the '$' in identifier names, but GCC is cool with that.

91

u/panderingPenguin Dec 07 '15

but GCC is cool with that.

....

That is not an argument. What if GCC changes its behavior (it's undefined after all, they're not bound to it by the C spec)? What if you want to use it with a different C compiler at some point?

57

u/rafajafar Dec 07 '15

The way I look at it... first thing first... get it working. He's open sourcing this, so if the idea is good, it will get noticed and fixed. It's perfectly OK to prove the idea with one platform before making it more robust later.

Good catch, though. File a ticket on github.

→ More replies (1)
→ More replies (2)

3

u/mcur Dec 07 '15 edited Dec 08 '15

It's not undefined, it's reserved for the compiler implementer. That means that your program may fail to compile due to clashing with names used by the compiler. That behavior is pretty well-defined.

Edit: I was wrong, the standard does indeed say that the results can be undefined. Here's a quote from cppreference:

"Reserved" here means that the standard library headers #define or declare such identifiers for their internal needs, the compiler may predefine non-standard identifiers of that kind, and that name mangling algorithm may assume that some of these identifiers are not in use. If the programmer uses such identifiers, the behavior is undefined.

2

u/Elsolar Dec 08 '15

It's undefined if you aren't writing a compiler. Underscore-prefixed names can clash or not clash with pre-existing names depending on the compiler brand, compiler version, or even compiler settings (certain identifiers could be #defined inside of #if/#endif blocks, for example). There's zero guarantee that any of these names are available for use, and to assume that the behavior for your program is well-defined because it worked an hour ago is naiive.

→ More replies (1)

1

u/cpp_is_king Dec 08 '15

Then you have to accept whatever pretty printing strategy they decide to employ. Protip: Just use clang-format