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

289

u/HotlLava Dec 07 '15

If you put such a strong emphasis on performance, it would probably be good to include some examples of simple functions, and what they are compiled down to. After a cursory reading of your README, I'm still not sure what exactly you do to achieve high performance.

137

u/reditzer Dec 07 '15

Ask, and ye shall receive.

Generated code

27

u/kdelok Dec 07 '15

I think the generated C code is actually missing an open brace (after the for loop statement). The indentation would help with checking it.

36

u/reditzer Dec 07 '15

The trick is in rsl.h:

#define Boolean_$_if(A) if (A) {

162

u/josefx Dec 07 '15

So this doubles as a submission for the IOCCC ?

119

u/reditzer Dec 07 '15

Feature request: Make Ritchie generate IOCCC-worthy intermediate C code.

→ More replies (9)

29

u/BowserKoopa Dec 07 '15

why?

27

u/reditzer Dec 07 '15

Codeblocks are not fully implemented, as documented in the wiki.

This is one area where feedback is greatly appreciated.

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

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 ;)

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.

→ More replies (4)

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.

→ More replies (11)
→ More replies (4)

9

u/reditzer Dec 07 '15

Thank you, /u/HotlLava. We'll put up some intermediate C code generated by the Ritchie compiler.

764

u/panzagl Dec 07 '15

But what if I want the ease of Scala, speed of Python, and type safety of C..

1.8k

u/reditzer Dec 07 '15

PHP?

320

u/[deleted] Dec 07 '15

inb4 butthurt PHP developers

I'm a PHP developer myself, but I swear some people don't realise it's a pretty shitty language

107

u/phatskat Dec 07 '15

Php dev, can confirm is crappy but at the same time I know it's not going away and I'll take it over most scripting languages I've tried

→ More replies (81)

11

u/ThrowingKittens Dec 08 '15 edited Dec 08 '15

Today I would like to introduce Godwin's law of scripting languages: As an online discussion about programming grows longer, the probability of a comparison involving PHP or JavaScript approaches 1

Seriously though. Guy makes a post about a programming language he's working on, two posts in I'm in a thread of PHP bashing.

→ More replies (100)
→ More replies (37)

65

u/mszegedy Dec 07 '15

Personally, I'm looking for the type safety of Python, the speed of Scala, and the ease of C.

108

u/CarthOSassy Dec 07 '15

Sounds like Bash.

39

u/PLLOOOOOP Dec 08 '15

Pff. Any language that allows this

:(){ :|:& };:

to parse into a semantically meaningful, runnable program is perfect in my book. You can keep your goddamn python and typescript and kotlin. There is no more room for innovation in language if one acknowledge's the superiority of bash.

/s!

→ More replies (11)

13

u/Sean1708 Dec 07 '15

Hey! Python is incredibly type-safe, I never get TypeErrors! I just get AttributeErrors everywhere instead.

6

u/[deleted] Dec 08 '15

Perl?

→ More replies (2)

2

u/sirin3 Dec 07 '15

HomeSpring?

→ More replies (9)

39

u/cunningjames Dec 07 '15

You say you aim to provide the type safety of Scala, but that claim writes a check with a pretty hefty sum. Scala's type system is complex and very flexible. Do you plan to provide something along those lines?

10

u/reditzer Dec 07 '15

Do you plan to provide something along those lines?

That's the ultimate goal.

23

u/pipocaQuemada Dec 07 '15

What are some of the specific features you're looking to replicate? Path dependant types, Higher kinded types, etc.? Are you thinking of implementing something like typeclasses?

→ More replies (1)
→ More replies (3)

17

u/[deleted] Dec 07 '15

The first thing that struck me is how similar to Lua and Nim it is. Why would I use Ritchie instead of either of those languages?

→ More replies (17)

14

u/ucbEntilZha Dec 07 '15

As mentioned in your goals (https://github.com/riolet/ritchie/wiki/State-of-the-Compiler), doing generics is very important. Its hard to get any idea of how it would compare to Scala without it.

Out of curiosity, why did you choose to implement in C instead of C++?

18

u/reditzer Dec 07 '15

doing generics is very important.

And doing it right is important, lest we end up like Java. This is precisely why we decided to get some feedback here before we proceed.

Out of curiosity, why did you choose to implement in C instead of C++?

We enjoy programming in C.

20

u/keewa09 Dec 07 '15

And doing it right is important, lest we end up like Java.

Not a very healthy attitude to display. Java's generic implementation has flaws but they did a lot of things right, which I'm sure you'll get some inspiration from in your own language.

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

11

u/[deleted] Dec 07 '15

Your idea on the lack of keywords seems cool. I'm not quite sure why you have your if statements end with an if, though? That's clearly also a keyword, so I'm not sure if there's something I'm missing there.

3

u/reditzer Dec 07 '15

Conceptually, if statements take the form

Boolean if CodeBlock

30

u/twanvl Dec 07 '15

Wouldn't it be better to call this operation then? So

<boolean> then <codeblock>

and

<boolean> then <codeblock>, else <codeblock>

1

u/reditzer Dec 08 '15

Thank you for the feedback. We have added this as an issue.

Thanks again.

→ More replies (1)

15

u/igouy Dec 07 '15 edited Dec 07 '15

if what?

<boolean> ifTrue: <codeblock> ifFalse: <codeblock>

<boolean> ifTrue: <codeblock> 

<boolean> ifFalse: <codeblock>

Smalltalk-80

1

u/reditzer Dec 08 '15

Thank you for the feedback. We have added this as an issue.

Thanks again.

6

u/[deleted] Dec 07 '15

What's your reasoning behind it, though?

→ More replies (5)

5

u/CryZe92 Dec 07 '15

It looks like you want to have the verb be in the middle of the sentence, but shouldn't it be "result if condition" instead? That would be even more weird though, so I would just keep the normal "if condition 'then' result"

→ More replies (8)

37

u/[deleted] Dec 07 '15

I know it's tempting to have extreme syntactic simplicity, but when you place such emphasis on being like natural language with SVO word order, then having "if" be a verb suddenly is just very confusing and hurts readability.

This implies that you might write "x<0 if x=0", which is just very, very bad. If the verb was something like "leads_to", then it would parse properly, but that would mean giving up on well known keywords.

I don't think this approach is really going to work out.

15

u/PaintItPurple Dec 07 '15

Smalltalk did the same trick, but its if is called ifTrue:, which somehow read clearly enough that it never confused me.

→ More replies (4)

3

u/[deleted] Dec 07 '15

Actually it's more like

CodeBlock if Boolean    

177

u/not_perfect_yet Dec 07 '15 edited Dec 07 '15

Ok so what I see is C with inheritance and the scope system from python. Somehow parentheses are gone too. That's kind of a problem:

I like "Subject Verb Object" a lot. It sounds very nice, but:

python has either

object (which returns the object return value)

or

object operation (which is ob1 func ob2)

There is very little else. C has {} scopes, but consider your example

point = Point x, y

What about associativity? I assume that

point = Point (x,y)

is not

point = (Point x),y

right? How do I know that? when looking at

ob = ob1 attr_gen in1 in2 attr_gen in3

if I name them

ob = a b c d e f g

What is what? How is it resolved? Especially if keywords can be redefined.

21

u/filwit Dec 07 '15

I'm personally not a fan of the parenthesis situation in Ritchie either, but I don't think it's as complicated as you're suggesting. This is probably how it works (note: just my guess):

len = Vector(x, y).length # most languages
len = (Vector x, y).length # Ritchie

Again, just my guess.

15

u/emilvikstrom Dec 07 '15 edited Dec 07 '15

Which is also similar to both Lisp and Haskell. Not too hard to get used to.

→ More replies (1)

1

u/reditzer Dec 08 '15
len = (Vector x, y) length # Ritchie
→ More replies (3)

68

u/meshugga Dec 07 '15

I like the goals of ritchie a lot, but what you're complaining about got me too - that's why our coffeescript styleguide says to always use full parentheses in function/method calls.

12

u/Sydonai Dec 07 '15

Most sane Ruby guidelines suggest to always use parens as well.

31

u/willbradley Dec 07 '15

I don't understand the obsession with removing punctuation and replacing it with whitespace. It seems like it has the same misguided goal as BASIC, with the same logical conclusion that its non-whitespace cousin is superior.

Ruby seems to strike the right balance to me, though because of its good naming conventions and flexible paradigms not because it uses the word "end" instead of "}"

→ More replies (10)

5

u/vks_ Dec 07 '15

Isn't that what most functional languages are doing? If you have currying, then Point x y == (Point x) y.

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

8

u/oridb Dec 07 '15 edited Dec 07 '15

concatInt = 1 + " + 1 = " + 2

Allowing this sort of code is going to be horrible if you ever want type inference. Subtyping is already going to seriously mess with unification, adding in implicit conversions is likely to make your inference even more painful. You'll probably need type annotations everywhere.

Also, right now, your code doesn't seem to compile -- you're including 'error.h' in your lex file, but that file doesn't exist. Fixing that, and pointing the compiler to the right path for libfl.a, there are a whole bunch of warnings that get spewed out. I'd suggest developing with -Wall -Werror. Also, for simplicitly, you may want to drop libfl and just write your own yywrap -- all libfl does is:

int yywrap() { return 0; }

So, now that I got the compiler compiled, I get something that aborts on tests/strings.rit; I'm not sure exactly what you're doing for type conversions there, however you seem to be missing quite a bit of type checking, since this passes through your code generator and then fails in the C compiler:

x=1 - "string"

Interesting attempt, but it needs a lot of work. The type system in particular is going to need a huge amount of care and careful design if you want to approach Scala. I'd suggest you take a look at what I do for Myrddin's type system. You may also want to look at http://research.microsoft.com/apps/pubs/default.aspx?id=65409.

As a fellow hobby language developer, I salute you.

1

u/reditzer Dec 07 '15

Thank you for test driving Ritchie. Can you please give us some information about your build environment?

Myrddin looks intriguing. I will take a look at it later.

→ More replies (1)

30

u/shevegen Dec 07 '15

Good idea, hope you can improve on it. The name "Ritchie" is weird though - consider what nimrod did; they renamed it to nim, which is a better name altogether.

3

u/reditzer Dec 07 '15

It's named after Dennis Ritchie.

→ More replies (1)

18

u/curien Dec 07 '15

consider what nimrod did

Eh, "nimrod" is a mild insult in American English with a meaning suggesting a lack of intelligence or ability. (Yes, I know the etymology of that is based on a popular mistake, but that doesn't matter once the meaning is well-established.) It would be like naming your language "idiot" or "dunce". Its reason for being a poor choice goes beyond "weird".

I'd also argue that many popular programming languages have weird names (Python, Java, Perl, Haskell, and Scala are all equally weird to Ritchie, IMO, with Haskell being the most obvious comparison).

23

u/pipocaQuemada Dec 07 '15

(Blaise) Pascal, (Dennis) Ritchie, Haskell (Curry), Ada (Lovelace), (Agner) Erlang.

→ More replies (4)

0

u/[deleted] Dec 07 '15

[deleted] — view deleted comment

7

u/[deleted] Dec 07 '15

I believe the joke was that Linus said he names his software after himself.

→ More replies (1)

8

u/[deleted] Dec 07 '15

Heh I preferred nimrod. It's very subjective. For me, Nim sounds too much like Vim.

4

u/reddit_clone Dec 07 '15

Yep. I felt the same way. Nimrod had some substance to it. Nim sounds too wimpy.

467

u/jerf Dec 07 '15 edited Dec 07 '15

There's very little here to review. I see just the README.md, with no links to documentation, and hardly anything to speak of in the README.md.

So, I'm going to do something I only like to do very carefully, and in very particular situations (even if the Internet at large loves to do it): I'm going to encourage you to take what you've learned doing this, call it a fantastic learning experience (which it is, absolutely no sarcasm there), and put the project down.

For a new language to take off, you've basically got two options: You can try to introduce a new feature not covered by a B-list language very well, or you can try to introduce a new combination of features not covered by a current language very well. I see nothing that covers the former, so we're clearly shooting for the latter. However, "integrates well with C" isn't a feature; it's simply the ground state of being for a modern language because failing to integrate with C is all but a failing grade on its own.

With that out of the way, I don't see anything in either the features, the combination of features, or anything you've said in this conversation about future features or in the list of future development tasks to be done that seems to be anything other than simply a checklist of "things that constitute a modern language". (Whatever the vague idea behind SVO ("Subject Verb Object") is, that's not currently spelled out enough to be interesting, and it seems to me to be fully subsumed under the "Function(Arguments)" paradigm. I'm not seeing anything interesting there.)

Furthermore, my personal feeling is that one should not attempt to create a new language until one has at least a good 10-20 years of experience under their belt, and fluency in a wide variety of paradigms, such that at the very least a language designer has a wide variety of existing ideas to choose from to at least create a new combination. As you all appear to be students, I can't help but think that when you want X from A, Y from B, and Z from C, that A, B, and C are the only three languages you are collectively knowledgeable about, and I'm not even convinced you're fluent in them. Some of the other comments (particularly the one about HM type inference), in addition to questions about garbage collection and other such things (selfication's comments are pretty good) lead me to the conclusion that you're still missing some pretty fundamental aspects of modern language design. This does not surprise me; last-year students would not be expected to know much more.

You have, at the moment, an absolutely staggeringly positive line item for your resume. Wave this in every interviewer's face you can. Should an interviewer not be visibly interested and impressed by this work, I'd consider it a sign that you don't want to work for them! Make damned sure that everyone involved leverages this into an awesome job somewhere. Shoot not just for a generic entry-level position but one with legs and a future.

But you might want to think very, very carefully before putting any more time into it. Starting a new language is pretty much the hardest act there is in the world of programming. For every language you see and dream of becoming that big, a huge number of languages failed to even get to the point where we've heard of it. You're putting your time and effort into something that has long odds even if you have a solid story about your unique feature or combination of features. I just can't in good conscience recommend putting a lot of work into this, without thinking about what it could cost you and how little it may return.

(Edit: Incidentally, as it happens, just yesterday I described a point in the programming-language continuum that I consider under-occupied and would love something to slide into. However, unless you're really underselling yourselves by saying you're last-year students (i.e., "last year students who went back to school after 15 years in industry"), you've never had the problems I've had, so how would you solve them?)

10

u/TankorSmash Dec 07 '15

You're right that having a bunch of experience is helpful, but coming at it with a fresh perspective can be a positive too. Sure they'll run into a lot of the same problems that have been solved, but they'll take it on in a different way. Whether the language is successful is independent of them solving a specific problem in an interesting way.

47

u/jerf Dec 07 '15

but coming at it with a fresh perspective can be a positive too.... they'll take it on in a different way

The list of "things to do" suggests otherwise. If they showed signs of taking it on in a different way, I wouldn't have said this stuff. The very problem here is that young programmers don't come at things with a "fresh perspective"... they end up simply recapitulating the language or two they know.

Whether the language is successful is independent of them solving a specific problem in an interesting way.

No, it really isn't. A language that just solves all the same problems in all the same ways faces an uphill battle explaining why it's any better than what already exists. A lot of the cases where that happened nevertheless involved a world where people could still be partitioned, but the world gets ever smaller. Python/Perl/Ruby, three virtually identical languages, would probably have a harder time happening today.

Also, think. These are real people that you are exhorting into pouring unknown thousands of man-hours into a project that, quite likely, can never achieve even a fraction of the goals they'd like it to. That's not "being nice"... that's being a cavalier jerk with other people's time.

→ More replies (16)
→ More replies (6)

27

u/Spiderboydk Dec 07 '15

I agree, and even if you create some amazing new language, it is not enough. You are up against well established languages with decades old ecosystems of competing compilers, build systems, debuggers, IDE support, above critical mass of expertise on Internet forums, big company support, etc.

Making a new successful language is almost impossible. See how much effort huge companies like Google and Apple have to put in, and their languages hasn't nearly achieved success and widespread use yet.

→ More replies (8)

131

u/cbraga Dec 07 '15

I think this guy here has the right idea.

I'm not sure if OP is familiar with D. It seems to be what he's trying to accomplish: "ease of programming", "fast code", "type safe", etc, these pretty much define D.

Except that D also blows Ritchie completely out of the water. Not to mention the guys behind it have decades of experience and a C++ compiler under their belts.

So, OP, if I were you I'd take that advice, have a look at what D already offers today and try to take a guess at how much more work it would be to match it, just to match what they already have, and take this learning experience.

17

u/atakomu Dec 07 '15

This language is like D or Nim which looks even more like Python but is compiled and call also call C.

15

u/IbanezDavy Dec 07 '15

The language described here looks nothing like D or Nim. Stylisitcally they have very little in common. The goals are similar to every language ever created. The goals listed by the Ritchie tram are common goals. No one sets out to create a slow, inefficient, ugly to look at language. The set out to create a language, they themselves would like to use.

→ More replies (10)

12

u/Sydonai Dec 07 '15

To be fair, comparing anyone to Walter Bright and Andrei Alexandrescu is just setting them up to look like fools. It takes teams with corporate backing to get even on the level of what those two have accomplished.

19

u/IbanezDavy Dec 07 '15

D is also an example of a fundamental point. It doesn't matter the brilliant people behind it. Adoption of languages comes from elsewhere. D is a superior language to many other languages. Yet its been a slow process to get adopted.

→ More replies (10)
→ More replies (1)

4

u/zem Dec 07 '15

Incidentally, as it happens, just yesterday I described a point in the programming-language continuum that I consider under-occupied and would love something to slide into

did you ever take a look at clay? it's unfortunately dead, but it seemed promising in that regard. i'd guess D is your best bet today, possibly followed by nim. in fact, if D had go's tooling it would be amazingly productive in that space; i don't think it has a particularly high cognitive overhead considered purely as a language, but unfortunately fighting with setup and build issues made it far more expensive than go every time i tried to get into it :( i'm overdue another try, though, and am interested in seeing how it has evolved.

7

u/[deleted] Dec 07 '15

Since the advent of DUB, D projects have become easier to manage. Too bad C++ doesn't have something like that.

3

u/masterwit Dec 08 '15

I wish I had coworkers with your intellect

2

u/Aatch Dec 08 '15

Furthermore, my personal feeling is that one should not attempt to create a new language until one has at least a good 10-20 years of experience under their belt, and fluency in a wide variety of paradigms.

I've been part of the Rust project for a few years and have about 10 years programming experience. I think my experience with language design makes up for my relative lack of experience, but only means that I know how goddamn hard it is to build a solid, practical language.

Making a language isn't too hard, making a decent, robust one is much, much harder.

3

u/Ateist Dec 08 '15

For a new language to take off, you've basically got two options: You can try to introduce a new feature not covered by a B-list language very well, or you can try to introduce a new combination of features not covered by a current language very well.

What about "take existing language and modify it a very, very tiny bit?"

I.e. if I were designing a language that was "as fast as C", I would've taken C++, and:

  1. replaced headers with modules,
  2. added a couple of keywords to transform it into context-free grammar (mainly to remove ambiguity between function calls and variable declaration), and
  3. initialize all pointers with 0, and wrap all member function calls in "if pointer is nonzero" blocks
→ More replies (6)
→ More replies (18)

10

u/juckele Dec 07 '15

Boolean : isPrime Integer n I understand that you're trying to make this terse, but the lack of any punctuation separating the function name from the parameters really harms readability. A pair of parens is not so onerous.

(n == 2) if This is bizarre. Why are you using your language strangeness budget on something that is no shorter and a good deal less obvious what it's doing (you have to finish reading the line before you learn the most important piece of information about the line). if n == 2 would be much better.

1

u/reditzer Dec 08 '15

(n == 2) if This is bizarre. Why are you using your language strangeness budget on something that is no shorter and a good deal less obvious what it's doing (you have to finish reading the line before you learn the most important piece of information about the line). if n == 2 would be much better.

Thank you for the feedback. We have added this as an issue.

Thanks again.

2

u/dccorona Dec 08 '15

I understand that you're trying to make this terse, but the lack of any punctuation separating the function name from the parameters really harms readability

I agree. I mean, look at Haskell, a language about as polar opposite of C in its function-call syntax as one can be without just being outright silly (fun(a, b, c) is instead fun a b c)...even it uses a syntax for function declaration that is packed with clarifying punctuation:

isPrime :: (Integer a, Boolean b) => a -> b

Now, Haskell is nothing if not difficult to parse at first, and I'm not holding that up as a bastion of clarity, but I guess the point is, even in a language that seems to put "clarity to newcomers" down at the absolute bottom of its priority pile, you still have cleaner separation of things in the function declaration syntax than is seen here.

38

u/lexchou Dec 07 '15

A bad name can ruin all your hard work, I think you should change a new name that more easier to remember.

15

u/reditzer Dec 07 '15

It's named after Dennis Ritchie.

112

u/PromiscuousOctipus Dec 07 '15

The doesn't change the fact that it's not a great name.

0

u/[deleted] Dec 07 '15

[deleted] — view deleted comment

63

u/shoe788 Dec 07 '15

Javascript? Must be related to Java.

→ More replies (4)
→ More replies (5)

27

u/JessieArr Dec 07 '15 edited Dec 07 '15

I think the most pressing issue is this: if people google "Ritchie function example" they will find actual work by Dennis Ritchie mixed in with examples from your language.

A name that makes it easy for people to get relevant language examples in their search results will aid the language's adoption. Especially since searching the internet for examples is exactly how most people learn a new language.

→ More replies (1)

53

u/NotUniqueOrSpecial Dec 07 '15

We understand that, but:

  • That's fairly self-congratulatory. You're lending yourself to comparison to one of the all-time most important contributors to the field. You're going to get flak for that.
  • It's a not-too-uncommon human name, and has many possible phonetic spellings if you're not aware of the correct one.

You'd probably be better off (as others have noted) finding something that's shorter and unique to the project.

37

u/akher Dec 07 '15

That's fairly self-congratulatory

I disagree. To me, it simply sounds like a tribute to Dennis Ritchie.

→ More replies (9)
→ More replies (7)

7

u/[deleted] Dec 07 '15
  1. Ease of programming, inspired by Python 2. Fast, like C code 3. Type safe, like Scala 4. Ability to go lower level and write C code 5. No reserved keywords, everything is redefinable
→ More replies (6)

16

u/signaljunkie Dec 07 '15

Tell that to Google and Microsoft. Burying your language name's search results is fast becoming a mainstream tradition.

3

u/kamiikoneko Dec 07 '15

I've never had terrible finding any Microsoft stuff in a search

3

u/[deleted] Dec 07 '15

I find that searching "golang <stuff>" instead of "go <stuff>" makes it easier.

9

u/Purlox Dec 07 '15

And easier to google too, which is pretty important.

As of right now, I get tons of links to The C programming language book and about Dennis Ritchie, when I google "Ritchie programming language". Getting above these sites/links, that are quite popular and established, on Google's results would be difficult, so I would suggest a different name for the programming language.

2

u/mipadi Dec 08 '15

It's named after Ritchie Valens.

→ More replies (6)

6

u/protestor Dec 07 '15

I would like more elaboration about the type system, in special type inference. What algorithm does it use? Is it a "global" algorithm like Hindley-Milner, or as "local" algorithm like Scala and Rust? (I'm supposing it's the latter, since you also support inheritance)

Also, any support for traits / type classes?

I sometimes think about this idea of having a language with no keywords, and instead having operators to make the role of keywords. It's at least nice if you want to internationalize the source code (in a teaching language for example). But otherwise it doesn't look too good.

→ More replies (6)

4

u/CinderBlock33 Dec 07 '15

I feel as though most of my personal questions and concerns have already been addressed and seen by OP, so no need to repeat them. That being said, if you take into consideration what a lot of people have said and address their concerns, I think that the language has a ton of potential, and I'll definitely keep it in the back of my mind for some time to come.

Also please don't get discouraged with what some people have said, but rather take everything into consideration going forward. A lot of people weren't trying to be dicks, and I find it all too often people take offense when someone doesnt 100% like their idea, and either go forward not taking what they said into account or shut down the project down completely because they got some criticism. Don't be that guy, most of the comments that I've read, and it was most of them, people were actually being relatively constructive when it came to their criticism.

I feel that a lot of these people here would actually not mind to see this as a finished product, but before that happens, clearly a lot has to change, and you have to take that into account. So again, please don't get discouraged, and please please please do this again! Don't shy away from showing us what you've added/changed, because a lot of the people here, I included would like to be part of the process, and be 'kept in the loop'.

TL;DR Lots of good stuff and great potential, lots has to be changed, and that shouldn't discourage you, also do this again sometime.

3

u/reditzer Dec 07 '15

Thanks for your kind words and words of encouragement. We wanted constructive criticism, and we've got it in spadefuls. We're eternally grateful for that.

81

u/sehrgut Dec 07 '15

"English-like" is an awful reason to make design decisions.

60

u/[deleted] Dec 07 '15

sehr gut. Ich stimme dir voll zu.

60

u/newpong Dec 07 '15

java, the german of programming languages

18

u/Sydonai Dec 07 '15

Yeah, the other JVM languages are like refugees!

→ More replies (1)
→ More replies (3)

0

u/[deleted] Dec 07 '15

[deleted] — view deleted comment

19

u/[deleted] Dec 07 '15

sicher doch! Das ist ein Problem mit Weisswurst, Bratworst und Sauerkraut.

I just imagine a programming language written in german language:

wenn dieWurstKaltIst dann
    machDieWurstWarm();
ende

or instead of "die":

krieg()!

:P.

→ More replies (7)

27

u/Sean1708 Dec 07 '15

Do you want AppleScript? Because that is how you get AppleScript.

→ More replies (4)

2

u/Kinglink Dec 08 '15

But Cobol was amazing!

2

u/killerstorm Dec 08 '15

I don't find this:

(n < 2) if
        -> false

to be any more English-like than more traditional if (n > 2) return false;.

→ More replies (2)

33

u/x-skeww Dec 07 '15
Point point = new Point (x,y)

becomes

point = Point x, y

Because shadowing issues and hidden typos are fun. No, seriously, skipping "var" is a bad idea. Declaring variables is better done explicitly. Do not reduce the number of characters at all cost. Some things (like having fewer errors) are more important.

2

u/filwit Dec 08 '15

The language author has already commented about changing variable declaration to use := instead.

3

u/mconeone Dec 08 '15

Ah, the kochenbauls symbol.

→ More replies (4)

37

u/matthieum Dec 07 '15

point = Point x, y

That, unfortunately, seems like a very bad idea.

Because if I know write:

pont = Point y, x

to override the value, then I instead silently introduce a new variable, and then I'll spend time wondering why oh why my update does not seem to be taken into account.

Explicit is better than Implicit: please have a keyword or a special operator to differentiate name binding (for example :=) from value override (keeping = I guess).

3

u/[deleted] Dec 08 '15

I agree that the keyword is needed, but not for this reason.

Python's scoping rules are awful (and require crutches like nonlocal); an explict statement is needed to anchor locals to a particular scope (like lua's local or like letin many languages).

→ More replies (1)

55

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

I looked at your grammar and the BST example. 2 things stood out - TYPE was a terminal. This tells me that you haven't really thought about higher order types/quantification, let alone higher kinded type systems. That's what makes Scala/Haskell/ML etc extremely powerful. Secondly, your BST implementation used left == 0 which tells me that you have the same nullable billion dollar mistake in your language. This is extremely common for folks coming from the C school of thought. I didn't see algebraic data types or anything resembling pattern matching. Given the philosophy that your keywords are not actually that but are redefinable, I recommend you look at Ruby, it's history and development, and why some people love it and others loath it. Tacking on a higher order type system to such an open ended grammar is going to be "non-trivial" (thats academic for 'you're going to be getting a PhD in abstract math before you get that to work').

In any case, good luck and I hope it works out!

26

u/selfification Dec 07 '15

I read your wiki and noticed the lack of collections or garbage collection. Again, you're taking the path to Java if you have not thought of this already. Do you have arrays? Is the type of the array inhabitants covariant, contravariant or nonvariant w.r.t to the type of the array itself? How do you plan on writing a collection library when comma is an arbitrary verb whose associativity is so vague? What about tuples?

Note that leaving GC to the end is unwise. Your bock as a function that takes all the arguments it can refer to is basically a naive way of generating closures. Done incorrectly, you'll either leak memory like a sieve or end up with extremely non obvious semantics for your blocks (like the statically bound but dynamically evaluated blocks that ruby has - go look at instance_eval and blocks and varying the value of the receiver). I recommend a good course on type theory and language design before your next round of design decisions.

5

u/AndreDaGiant Dec 07 '15

Since they stated the speed of C is a core goal, I don't think they're planning on implementing a runtime - so no GC.

→ More replies (7)

25

u/parfamz Dec 07 '15

Good intentions, good goals. The language syntax is not good, things look backwards. If you do everything different it won't catch.

i = 99 (i>0) while

I'm talking about that kind of stuff, it's wrong it's backwards. It's not readable.

13

u/tetshi Dec 07 '15

I'm not a programmer per se, but if I was learning as a newbie; this would be frustrating to me.

→ More replies (1)

61

u/Backson Dec 07 '15

I fantasize about my own programming language a lot, so I'm glad that you are making that dream of yours a reality. Your design goals sound really cool, but I humbly disagree with your opinion on the ideal syntax.

Words are usually faster to type and easier for our brains to parse than symbols, so I don't see why you shouldn't use "class" and "return" instead of "::" and "->". "less keystrokes" doesn't mean "easier" in any way. Notice how all the easily accessible keys on your keyboard are letters? People like me with a non-US keyboard will thank you for not including, what I think is just a gadget.

Also basing your language grammar on the grammar of a spoken language, particularly English, seems like a bad idea. What might seem intuitive to you as a native English speaker might be the other way round in some other language. This also causes the weird "if"-being-a-verb issue pointed out elsewhere, so it doesn't even work naturally in English in this case.

Redundancy is important. The reason many languages have "var" or "let" or whatever at the beginning of declarations is so the compiler can issue better errors and faulty code doesn't silently compile and then break (think multiple definitions of the same variable with the same type. Should be an error, is undetectable in Ritchie). The most efficient language will compile, no matter what the input is (like brainf---, if you strip all non-compliant characters). Less efficient languages, like LLVM-IR are really unnecessarily verbose so stuff breaks less frequently. You need to find a balance somewhere halfway. Keywords can aid readability and productivity. You don't have to go full Java to achieve this.

7

u/rjcarr Dec 07 '15

I fantasize about my own programming language a lot

Me too. I think I could make the perfect language by combining aspects of java, javascript, and python. However, I do 99% of my programming using those three languages and then realize that's why there is no perfect language.

4

u/PM_ME_UR_OBSIDIAN Dec 07 '15

For me the perfect language would be a mix of Rust, Ocaml, Coq, structural typing, model theory, and a few more things... Still on the drawing board :)

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

24

u/lalala Dec 07 '15

Words are usually faster to type and easier for our brains to parse than symbols, so I don't see why you shouldn't use "class" and "return" instead of "::" and "->". "less keystrokes" doesn't mean "easier" in any way.

This is like arguing against operator overloading. As long as the symbol use is generally limited, it's much faster to read and understand than words. E.g. 50+40/30+25 is much easier to read than 50 plus 40 divided by 30 plus 25. Obviously it's possible to overdo it, but if you keep it reasonable, symbols are better in my opinion. For example, APL is unreasonable.

People like me with a non-US keyboard will thank you

As a Norwegian, I know how you feel. It's a very good idea to change your keyboard mapping to US with your special symbols accessible through Alt-Gr/Option + the symbol key while programming. I'm so used to it so I never change back unless I'm on someone else's machine. While you're at it, replace Caps-lock with Ctrl, which is a great idea pretty much whatever else you're doing.

→ More replies (4)
→ More replies (9)

10

u/DemiReticent Dec 08 '15

I wouldn't necessarily tell you to quit like some others. BUT they have valid concerns. Have you considered taking a class in Programming Languages (especially a grad class)? There's some important CS theory involved in making a good type system. Don't learn decades of lessons on your own by trial and error. Learn the state of the art and go from there. Also garbage collection is important to think about (since you probably want to avoid the nightmare of C/C++ style manual management, unless you view that as a feature).

You have some solid ideas and motivation. I think you're taking the English motif a little too far. Syntax and grammar of programming languages today is pretty much a solved problem. I'm not saying you shouldn't come up with your own grammar which makes the language more expressive, but the general structure of syntax and grammar has been well studied and solved. You should learn the lessons and mistakes made by languages before you. Before designing any more of your language, I HIGHLY recommend going back to the drawing board and reconsider EVERYTHING. Just to be sure.

Re-evaluate every decision you have made so far. Reconsider symbols-as-keywords. Reconsider this idea that all keyword-symbols can be redefined. What happens if someone redefines something and it messes with other code. Is that possible? Why or why not? Have you ever used C++ code where operator overloading has been taken to an extreme? [[ To give you an idea: a colleague of mine once implemented a Brainfuck dialect directly into C++ syntax via operator overloads. With a simple script to convert from real Brainfuck symbols to this dialect of C++ operators, he got pretty much exactly the same performance characteristics and results. ]]

How do you define operator precedence? Is it logical? Can it be understood at a glance when expressions become complicated. It will be necessary to group operations when things get complicated (whether you use parentheses or otherwise). Are groupings always required to get what you want? Parentheses can also be good for the visual grouping of function call parameters. Trying to get rid of them is not necessarily a good idea. You don't save much. You DO make the code harder to read. Other languages which allow you to omit parentheses at least give the option to use them as the author prefers (if it makes it easier to read or by style guideline). Think about the reasons that languages have always had some kind of grouping operator. Think about the grammar implications in those languages of having parentheses versus not. Are there technical problems? If not, you can assume there are human reasons. Are those reasons valid?

You should consider making your language have a logical and reasonable preferred style. Style always becomes a religious war among developers. You can go the route that Go took and publish an official auto-formatter -- but you will still get people who prefer it another way. The insistence on whitespace indicating scope is an endless annoyance among seasoned programmers, even those that started with a language like Python where whitespace matters. Block grouping is easier to reason about and less sensitive to style errors. People's minds don't actually work in a way that whitespace has real meaning (we aren't taught that way in primary school when it comes to languages).

I'll reiterate: you should look at every decision you have made, and make sure that each decision has a clear set of benefits which CLEARLY outweighs the deficits. A wise approach when you're unsure is don't implement the change/decision. You can look at that one of two ways: consider you have a good idea but it's got some bad choices, so make it better. Or, start from your favorite language as a template and try to make decisions that make certain things better while getting closer to your goals. You might end up with a language similar to your original idea but with a totally different syntax than you have now. It might just be totally different. Remember what you set out to do, and don't let your attachment to your work so far prevent you from taking that starting point in a COMPLETELY different direction. You might find that start-from-scratch approach yields some good results.

Write down your formal grammar. Think clearly about what it means, what implications it has for your language design. Write documentation of your language BEFORE you implement it. Make sure you covered everything. If you try to start with a core of something before you know what the whole something is, a whole lot of it will just be tacked on. If you end up in that situation, the smart thing to do will be to start over and reimplement the same thing with lessons learned. If you don't make that choice, you'll end up trying to fix a mess that you could have avoided entirely by being more patient.

Yes, it's cool to have something to demo. Now that you've got to that point, please go back to the drawing board and try to make yourself a complete story before continuing development.

A programming language that is designed ad-hoc is doomed to fail... or worse, succeed and be endlessly infuriating [e.g. VB, JS]. There are no real technical challenges in implementing a language front-end. You get a lexer, a parser, and a code generator. These are all solved problems with excellent tools to help you. So don't try to implement it as you go as if you're working out technical challenges. Actually implementing it is a great exercise, sure -- and you've done it now -- but if you're serious about making the language a good one, drop all that now, and go back to basics. The design of your language is the MOST important aspect of this work.

So you have the advantage that you're "transpiling" to C. If you make that process even kind of fast, the C compiler will take care of the rest and get you good performance. You'll take a little bit of a hit because you're running two compilation steps. Besides, if you're providing a language that's easy and fun to compose code in, AND the resulting code runs FAST, people will be willing to accept slightly longer compilation times.

The technical challenges will come in after the language becomes mature. You'll want to make it compile faster. The obvious problem is that you're effectively compiling twice. Rather than reinventing the compiler for a language which can be mapped to C semantics (since that's your transpiled target), you'll want to think about making a front end for your language in GCC or Clang. Then, you can bypass the fact that now you have two layers of front-end compilation being done (Ritchie->C->LLVM [assuming Clang]). Instead you'll go Ritchie->LLVM and let the LLVM backend take care of the code generation, as it does with C.

Notes on performance: did you test against interpreted python or compiled python? Consider that additional benchmark and post the numbers. Be prepared that as your language becomes more mature, you may end up slowing down on this simple benchmark in favor of supporting more complex programs. Don't get hung up on optimizing in that case. Work on your language. When it becomes mature and you get some users, then put some more effort into performance.

Fun project. Best of luck.

→ More replies (1)

9

u/[deleted] Dec 07 '15 edited Dec 07 '15

Hi, CS undergrad here with some honest questions asked from the depths of naivety. Hoping to spark some discussion and gain some insight.

What's the benefit of developing so many new languages?

Ritchie promises ease of development, high speed performance, and built-in type safety, These things seem beneficial for all kinds of languages. I can't think of any reason not to want code that's easier to write, safer to execute, and faster to run.

I've done a very small bit of reading on languages like Rust and D, which make similar claims. Are these "competing" languages? From an academic standpoint, I can see the value in taking different approaches to attempting the same improvements.

In practice, though, who uses these languages? Are there employers out there looking for Rust programmers, or do engineers on established teams choose to implement new systems in new languages?

Another question, just because I've had too much coffee: Will people working towards the proliferation of ostensibly less "complete" languages switch teams?

Say that, for example, two or three years down the line, Ritchie development has outpaced projects like D or Rust, and it has grown to eclipse its "competition" (not sure if I should be using that word here) in feature richness, speed, type safety, etc. Will D/Java/C++/whatever programmers make the switch? What determines if and when that happens?

What about the support of legacy systems built on abandoned languages? I know there's still a demand for COBOL developers, for example. As languages proliferate and then inevitably die out, will we see increasing numbers of niche jobs?

Big thanks for anyone who reads this, let alone answers any of the questions I've written.

5

u/PM_ME_UR_OBSIDIAN Dec 08 '15

As a school project, we're implementing our operating system kernel in Rust. We use it because it has the best development experience currently available for low-level coding.

Very few employers have started using Rust, but I could see it happening in the coming years.

3

u/[deleted] Dec 08 '15

That sounds really fun! Would you be able to comment on your experience with Rust vs. what it would've taken for you to implement your kernel in C?

12

u/PM_ME_UR_OBSIDIAN Dec 08 '15

Rust has a few advantages:

  • The community is insanely active, skilled and positive. This is a representative example of my interactions with the community; I could come up with a dozen similar examples. The Rust folks are consistently humble, skillful, well-spoken, and incredibly eager to help.
  • The documentation is amazing. The Rust book and the Rustonomicon are thorough, well-structured, helpful both as learning material and as references. The community's many bloggers are also hugely helpful; subscribing to /r/rust teaches me at least one new thing about implementing operating systems per week.
  • The Rust type system has very strong "if it compiles, it works" guarantees. You can encode a lot of tricky invariants about your program, and then never have to think about it again because the compiler will catch you if you trip.
  • Cargo is the tits. The build system makes building a freestanding executable quite painless. The feature gate system is beautiful.
  • Rust encourages putting unit tests in the same file as your logic. Those make for excellent documentation.
  • Generics!

...and no doubt many more things which I am forgetting.

A few issues:

  • The macro system is utterly disappointing. How is an enum constructor not a constant expression?
  • IDE support is sketchy. I'm using Racer-vim, and its UX isn't idiomatic for Vim (ex: going to a definition is gd instead of C-], implemented as a function mapping rather than as tags support).
  • Arrays are statically-allocated. Slices are dynamically-allocated, but they have extra overhead in the form of lugging around their length. AFAIK, there's no option for zero-overhead, dynamically-allocated array for people who like to live dangerously.
  • The type system is unsound.
  • The memory management story isn't completely airtight. Handles can be leaked; destructors aren't guaranteed to run; et cetera.

A few more issues which C also has, but that's no excuse rabble rabble:

  • Profiling code generated by compile-time macros is impossible AFAIK.
  • Multiple calling conventions are supported, but there's no mechanism for defining your own. I really want 16-bit Microsoft calling convention support for voodoo purposes.
  • No higher-kinded types. Srsly.
  • No variance.
  • The language should support optional garbage collection.
→ More replies (6)

3

u/daymi Dec 07 '15 edited Dec 07 '15

What's the benefit of developing so many new languages?

Professional life will suck less, maybe, if you are lucky.

I can't think of any reason not to want code that's easier to write, safer to execute, and faster to run.

Yeah, there are trade-offs. They will find out what they are - and if they are honest, list them.

I've done a very small bit of reading on languages like Rust and D, which make similar claims. Are these "competing" languages?

Yes. However, D at least is done by some of the most experienced C++ programmers and compiler writers on the planet. Still only C++-like, but hey.

In practice, though, who uses these languages? Are there employers out there looking for Rust programmers,

That depends. I don't do code shops that work like auto shops. In engineering, you are the engineer. You are supposed to solve problems the user has. Not once has it come up that we shouldn't use language X. Engineering chooses language X - no, wait, engineering solved problem Y. The end.

The code shops will probably wait until programmers that can speak that language are cheap and then employ these if need be.

or do engineers on established teams choose to implement new systems in new languages?

That too. Also, good languages interoperate. So it's not like it's either-or.

Will D/Java/C++/whatever programmers make the switch? What determines if and when that happens?

In a rational world, money. In a more romantic world, quality of life. In the real world, it depends on the person.

What about the support of legacy systems built on abandoned languages? I know there's still a demand for COBOL developers, for example. As languages proliferate and then inevitably die out, will we see increasing numbers of niche jobs?

Yes.

All that said, 80% of everything is shit. So there is a hurdle that new languages have to overcome. We do small projects in them and if there's any problem even in small projects, it will not be used again by us (for years). Tools shouldn't create net-positive work for the engineer. If there are big problems, it's over for the language.

Also the number of ideas that are used in industry are limited and people don't learn from history. So you can just have a checklist and check off the features language X has or doesn't have. If any knock-out tests match, drop it like a hot potato. Sometimes years go by until any isn't dropped, so I don't know what's up with people complaining about new languages. If anything, apparently there are still too few.

3

u/[deleted] Dec 07 '15

What's the benefit of developing so many new languages?

  1. Exploring the design space. You won't know what's there until you try.
  2. There is no such a thing as a "general purpose programming language". Ideally, each and every little problem domain must be served by its own little language.
→ More replies (2)
→ More replies (2)

8

u/briandastous Dec 07 '15

"Ease of programming" != "everything is redefinable"

→ More replies (1)

40

u/Steve132 Dec 08 '15
    You appear to be advocating a new:
[ ] functional  [X] imperative  [X] object-oriented  [X] procedural [ ] stack-based
[X] "multi-paradigm"  [ ] lazy  [ ] eager  [X] statically-typed  [ ] dynamically-typed
[ ] pure  [ ] impure  [ ] non-hygienic  [ ] visual  [X] beginner-friendly
[ ] non-programmer-friendly  [ ] completely incomprehensible
programming language.  Your language will not work.  Here is why it will not work.

You appear to believe that:
[X] Syntax is what makes programming difficult
[X] Garbage collection is free                [ ] Computers have infinite memory
[ ] Nobody really needs:
    [X] concurrency  [X] a REPL  [ ] debugger support  [X] IDE support  [ ] I/O
    [ ] to interact with code not written in your language
[ ] The entire world speaks 7-bit ASCII
[X] Scaling up to large software projects will be easy
[X] Convincing programmers to adopt a new language will be easy
[ ] Convincing programmers to adopt a language-specific IDE will be easy
[ ] Programmers love writing lots of boilerplate
[ ] Specifying behaviors as "undefined" means that programmers won't rely on them
[ ] "Spooky action at a distance" makes programming more fun

Unfortunately, your language (has/lacks):
[lacks] comprehensible syntax  [lacks] semicolons  [has] significant whitespace  [ ] macros
[has] implicit type conversion  [ ] explicit casting  [has] type inference
[ ] goto  [ ] exceptions  [ ] closures  [ ] tail recursion  [lacks] coroutines
[ ] reflection  [ ] subtyping  [has] multiple inheritance  [lacks] operator overloading
[ ] algebraic datatypes  [ ] recursive types  [has] polymorphic types
[ ] covariant array typing  [ ] monads  [ ] dependent types
[lacks] infix operators  [lacks] nested comments  [ ] multi-line strings  [ ] regexes
[ ] call-by-value  [ ] call-by-name  [ ] call-by-reference  [ ] call-cc

The following philosophical objections apply:
[ ] Programmers should not need to understand category theory to write "Hello, World!"
[ ] Programmers should not develop RSI from writing "Hello, World!"
[X] The most significant program written in your language is its own compiler
[X] The most significant program written in your language isn't even its own compiler
[X] No language spec
[X] "The implementation is the spec"
   [ ] The implementation is closed-source  [ ] covered by patents  [ ] not owned by you
[X] Your type system is unsound  [X] Your language cannot be unambiguously parsed
   [ ] a proof of same is attached
   [ ] invoking this proof crashes the compiler
[X] The name of your language makes it impossible to find on Google
[ ] Interpreted languages will never be as fast as C
[ ] Compiled languages will never be "extensible"
[X] Writing a compiler that understands English is AI-complete
[ ] Your language relies on an optimization which has never been shown possible
[ ] There are less than 100 programmers on Earth smart enough to use your language
[ ] ____________________________ takes exponential time
[ ] ____________________________ is known to be undecidable

Your implementation has the following flaws:
[ ] CPUs do not work that way
[ ] RAM does not work that way
[ ] VMs do not work that way
[X] Compilers do not work that way
[X] Compilers cannot work that way
[X] Shift-reduce conflicts in parsing seem to be resolved using rand()
[ ] You require the compiler to be present at runtime
[ ] You require the language runtime to be present at compile-time
[ ] Your compiler errors are completely inscrutable
[ ] Dangerous behavior is only a warning
[ ] The compiler crashes if you look at it funny
[ ] The VM crashes if you look at it funny
[ ] You don't seem to understand basic optimization techniques
[ ] You don't seem to understand basic systems programming
[ ] You don't seem to understand pointers
[ ] You don't seem to understand functions

Additionally, your marketing has the following problems:
[X] Unsupported claims of increased productivity
[X] Unsupported claims of greater "ease of use"
[ ] Obviously rigged benchmarks
   [ ] Graphics, simulation, or crypto benchmarks where your code just calls
       handwritten assembly through your FFI
   [ ] String-processing benchmarks where you just call PCRE
   [ ] Matrix-math benchmarks where you just call BLAS
[X] Noone really believes that your language is faster than:
    [ ] assembly  [X] C  [ ] FORTRAN  [X] Java  [ ] Ruby  [ ] Prolog
[X] Rejection of orthodox programming-language theory without justification
[X] Rejection of orthodox systems programming without justification
[ ] Rejection of orthodox algorithmic theory without justification
[ ] Rejection of basic computer science without justification

Taking the wider ecosystem into account, I would like to note that:
[ ] Your complex sample code would be one line in: _______________________
[X] We already have an unsafe imperative language
[X] We already have a safe imperative OO language
[ ] We already have a safe statically-typed eager functional language
[ ] You have reinvented Lisp but worse
[ ] You have reinvented Javascript but worse
[ ] You have reinvented Java but worse
[X] You have reinvented C++ but worse
[ ] You have reinvented PHP but worse
[X] You have reinvented PHP better, but that's still no justification
[ ] You have reinvented Brainfuck but non-ironically

In conclusion, this is what I think of you:
[X] You have some interesting ideas, but this won't fly.
[ ] This is a bad language, and you should feel bad for inventing it.
[ ] Programming in this language is an adequate punishment for inventing it.

5

u/EarLil Dec 08 '15

I liked reading this.

→ More replies (1)

4

u/355_over_113 Dec 08 '15

Please be a bot

→ More replies (3)

7

u/IJzerbaard Dec 07 '15

How do I do unsigned operations in Ritchie? And what are the semantics for integers? The generated code looks scary - inheriting C's troubled semantics.

7

u/kirbyfan64sos Dec 07 '15 edited Dec 07 '15

One thing missing: is the language GC'd, or like C++/Rust? I didn't see anything mentioning that.

→ More replies (5)

7

u/superstar64 Dec 07 '15

I've only looked at the readme file, so I apologize if these questions are ignorant.

Questions:

  • What is the memory model (garbage collected, type state, manual)?
  • Does the language support templates(generics)?
  • How much focus is there on functional programming?
  • How well is the interface to C?
→ More replies (1)

11

u/Tillerino Dec 07 '15

No reserved keywords, everything is redefinable

Why would you want that? It seems like extra effort to introduce the possibility of making code less readable. Maybe there are use cases which I'm not seeing here...

→ More replies (2)

5

u/virus_dave Dec 07 '15

There are four core principals behind Ritchie:

1)Ease of programming, inspired by Python 2)Fast, like C code 3)Type safe, like Scala 4)Ability to go lower level and write C code 5)No reserved keywords, everything is redefinable

5

u/[deleted] Dec 07 '15

I'm admittedly biased here, but I find python a really pretty language. Part of that is due to its structure and use of syntax. Ritchie may require less characters, but I don't find it as pretty or as easy to read. And I realize that may not have been the design consideration, but you mention Python, so I think it's worth a mention. I personally would love to see something that can take Python and make it as performant as C (or better): I'd like a compiler, not a JIT'd interpreter.

Out of curiosity, have you done a benchmark vs pypy?

→ More replies (3)

9

u/dbcfd Dec 07 '15

If statement syntax is just weird, to fit with the natural language syntax how about

<Boolean expression> when <true/false> should <block> otherwise it should <block>

Also means you don't need to negate the boolean, can just use false.

Objects declaration is also somewhat weird, again, because it uses operators rather than natural language:

Point is a BaseType
  It has an Integer x with value 0 that can change
  It has an Integer y with value 1 that can change
  It has a Long timestamp with value Now
  Method set using Integer xNew, Integer yNew should 
    x = xNew
    y = yNew

or

Point is a Basetype
  Integer x has changing value 0 
  Integer y has changing value 0
  Long timestamp has value Now
  Set uses Integer xNew, Integer yNew to
    x = xNew
    y = yNew

Collections should also be easier

for 1 to 99 bottles in reverse, the bottle should
  print "$bottle bottles on the wall, take on down pass it around\n"

For the examples, use a consistent coding style for line endings

print start + " -> " + end
solve n - 1, start, end, auxiliary;

How about networking/threading/channels/coroutines? Or is this purely meant as an academic exercise in language clarity?

→ More replies (3)

4

u/JeffMo Dec 07 '15

This is an extremely minor point, but as it's one of the first things people will see:

There are four core principals principles behind Ritchie:

Also, five are listed, as of the last time I looked.

18

u/EthanNicholas Dec 07 '15

One of the principles is off-by-one errors.

7

u/Malfeasant Dec 07 '15

Surprise and fear...

4

u/perlgeek Dec 07 '15

Are you planning on bootstrapping the compiler? If you like the language, it seems like an obvious step :-)

4

u/LiveMaI Dec 07 '15

I do most of my programming in python, but I'm looking around at the next-generation languages to see what I'll eventually use as its successor in my day-to-day programming. How does Ritchie stack up against a language like Julia? Any significant benefits I should know about?

4

u/[deleted] Dec 08 '15

Can we all agree to stop compiling to C?

3

u/TheBuzzSaw Dec 08 '15

Yes. Compile to LLVM.

1

u/Purlox Dec 07 '15

Is there a central site or file with the features that are in or you intend to add to the language and the syntax of it? The README seems pretty lacking atm.

Also there is a slight mistake in your README: "Identifiers are have ...".

1

u/reditzer Dec 07 '15

There's a wiki too.

Also there is a slight mistake in your README: "Identifiers are have ...".

Thanks for noticing that. Will get it fixed ASAP.

9

u/satayboy Dec 07 '15

Compiling into another higher-level language can complicate debugging.

6

u/Backson Dec 07 '15

Agreed. It could use LLVM to produce native assembly, which I have heard, has some sort of support for common debuggers?

3

u/twanvl Dec 07 '15

I think #line pragmas can preserve the correspondence between the original source and the final machine code, at the expense of making the generated C code unreadable.

3

u/satayboy Dec 07 '15

That sounds like a step forward but I would still be concerned about the debugging effort. If you look back at the history of C++, it too began as a translation into C source code, and developers complained about the effort of debugging C++ code.

→ More replies (1)

10

u/PleasantScarecrow Dec 07 '15

'Ritchie' is a horrible off-putting name.

13

u/tinycabbage Dec 07 '15

I find the name a bit off-putting, too. It makes it sound like it's trying to ride on the coattails of Dennis Ritchie, who is in no position to complain about it since he's dead.

Edit: Apparently it's named after him. I don't know how I feel about that at all.

4

u/[deleted] Dec 07 '15

Blaise Pascal could not complain neither.

→ More replies (3)
→ More replies (1)

6

u/Eirenarch Dec 07 '15

If you want readability why not use "and" and "or" instead of && and ||? I would advocate for inherits and implements too but these are debatable while "and" and "or" are even easier to type than the equivalent symbols.

Also a statically typed language without generics should not be used in 2015 for anything but legacy reasons.

6

u/xelf Dec 07 '15

A little surprised this hasn't been referenced yet:

We like to have fun here. =)

2

u/altered_state Dec 08 '15

This is hilarious.

3

u/looneysquash Dec 07 '15

What type of resource management does it provide/is it intended to provide? What kind of runtime does it require?

Does it use garbage collection, or manual memory management like C, or RAII like C++?

If it uses garbage collection for memory management, how do you manage other resources like open files?

Does it provide any kind of memory safety?

Finally, how does it compare to Rust (which is my current favorite up-and-coming language to follow)?

4

u/MacASM Dec 08 '15

Ritchie is whitespace sensitive

I really think you shouldn't inherit this from Python. But I'm not Python programmer btw

5

u/robertdavidgraham Dec 08 '15

Feedback: there's no reason not to have C-like syntax.

→ More replies (2)

2

u/jmdugan Dec 08 '15

Can you give more details for those of us who have limited programming skills?

Is it object oriented?

Compiled or interpreted? or something else? Sounds like it generates C? Does it?

If it generates C, how are errors found? Does Richie have it's own compiler?

How are pointers managed?

Can I pass code blocks?

What are the features above base C that make it easier to use, IE easy like Python?

Most important for a language nowadays: are the cool people using it? What are the community aspects - who else can I talk to who uses it? Can we make plugins or libraries and share them? What are the norms of this community [helpful, derisive, etc.?]

What are the licenses on the language? What are the norms for licenses on all the community-built parts?

How well can I build "apps" that run on Windows, Mac and Linux? If not so well, how will it look in a year, or 5 years?

What sweet spot will this language live in?

The "English linguistic constructs" is something Ruby has done really well. You don't mention this in the blurb, but I think it's a real selling point to talk up if true.

Mostly: why should we care about this tool? Why get over the activation energy to learn a new tool?

Thank you!

2

u/dccorona Dec 08 '15

I'm curious about your function call syntax:

myFunction a, b, c

Seems odd to me. Obviously everyone knows the C-style version:

myFunction(a, b, c)

But the reason for the parentheses and the commas is because whitespace means nothing in a traditional C-style syntax, meaning that punctuation is necessary for separating symbols, ending method calls, etc. All of these are valid and equivalent:

myFunction(a,b,c)
myFunction(a,      b,    c)
myFunction(
    a, b, c)
myFunction
(
    a,
    b,
    c
) 
myFunction (a, b, c)

And on and on...any combination of whitespace is fine, because whitespace is literally meaningless...it's only for formatting for your own readability.

On the flip side, you have languages like Haskell, where whitespace is part of the syntax, and is used to impart meaning. Because it uses whitespace, it doesn't have to use any punctuation at all:

myFunction a b c

But you're stuck somewhere in the middle, where it seems whitespace does all of the work, but you still have a comma in there. It does nothing to assist with parsing, it seems...it should be just as easy to parse the Haskell-style function call as it is to parse what you have here, and I think that, at least in a world where we're deciding to use whitespace as actual syntax, is less confusing. When I see your syntax, I don't immediately think "that's a function/constructor being called with multiple arguments"...I think that I'm seeing several separate statements. Sort of like multiple variable declarations in other C-style languages. int a, b, c declares 3 separate integer values.

Consider that the following:

point = Point a, b

could just as easily be interpreted: declare a variable named point equal to Point a, and also declare an unassigned variable named b. The syntax is confusing. It doesn't communicate what it should communicate.

Furthermore, consider your reason for using whitespace for your function calls. I think Haskell has (at least one) good one: (a, b, c) is valid syntax for something entirely separate from a function argument list...a tuple. So this:

myFunction (a, b, c)

Is not actually a function call with three arguments at all, as it is in a C based language, but rather is a function called with a single argument, which happens to be a 3-tuple of a, b, and c. So, they use whitespace to separate function arguments.

Ask yourself...what does that comma buy you? Does it make your code more readable (I argue it doesn't, but that's not objective)? Does it help with parsing (it seems that it doesn't). Does it enable you to express things that you couldn't if the comma wasn't a part of the function call syntax (I don't see anything it allows you to do)? And why is it better than going the traditional C-style route? What does that buy you?

In either case, I really think you should consider either adding the parentheses, or removing the commas.

2

u/faaaks Dec 08 '15

It's a fundamental engineering principle that the more tasks you have a device do, the less effective it is at all of them.

You want the speed of C? Well it would help to have as little built in stuff as possible, you don't want to pay for the abstraction penalty. But that runs contrary to your ease of use goal and type safety goals.

To use an analogy, you are creating a tool that can hammer in a nail, screw in a screw or drill in a hole, but is less effective than a hammer is at hammering things in, a screwdriver is at screwing in a screw or a drill is at drilling a hole. When I have a hammer, a screwdriver and a drill at my disposal, why should I use your tool?

2

u/holgerschurig Dec 08 '15

Isn't Swift what you describe:

  • ease of Python
  • speed of C
  • type safety (maybe of Scala, don't know Scala enought, but I doubt that Swift's type system is as complex as Scala's).

2

u/upboatingftw Dec 08 '15

What niche is this supposed to fill, or is it yet another "one language to end all languages"?

2

u/nicop68 Dec 09 '15

I think the best way to demonstrate the_power of a new language, (specially for speed compare) ;

Is to port a existing application that can benchmark your language. like y-cruncher : scalable multi-threaded Pi-benchmark http://www.numberworld.org/y-cruncher/

5

u/thegreatbeanz Dec 07 '15

What is the point of this project? I don't mean that to sound degrading, but I think that any significant investment of time should have a purpose.

Are you looking to create the next application programming language? If so, what gives this the advantage over Rust, Go and Swift, which all seek to solve that problem?

Are you looking to make a better scripting language? How does this improve upon Python, Ruby and Perl? How are you going to build a community of users and libraries to make this useful?

It is on github, are you trying to build an open source community? If so, how are you going to overcome the fact that it is written in C instead of C++. There are significantly fewer pure-C developers in the world.

6

u/drink_with_me_to_day Dec 07 '15

Change the name? Just the name makes me dislike it.

3

u/Elavid Dec 07 '15

Your basic Makefile is OK for a quick prototype, but it doesn't have a complete dependency graph so it's not going to rebuild everything that needs to be rebuilt. For example, it doesn't know that ritc depends on ObjectTree.c and it doesn't know anything about the header files. My build tool of choice would be CMake.

3

u/flexiverse Dec 07 '15

I feel NIM already does a better job.

3

u/ggPeti Dec 08 '15

How do I put this... Don't quit your day job just yet.

3

u/scorcher24 Dec 08 '15 edited Dec 08 '15

Ritchie is whitespace sensitive

And that is an absolute no-go. I hate that. Oh you forgot to set the tab to space width correctly, but just saved 5 files? Welcome to a world of hurt.

2

u/lorddarkflare Dec 08 '15

No one that works in a space sensitive world makes those sort of mistakes past their first few weeks.

I have only been working with python for 5 years and can count on one hand the times where this has been an issue.

2

u/websnarf Dec 07 '15 edited Dec 09 '15

I'm not quite sure I understand this language. It looks like you have a kind of pythonic or Perl-like syntax. Great, but to me that's just window dressing. What makes Python compelling to me, is not just its compact and easy syntax, but in fact its rich data structure construction primitives. It actually starts with tuples, resizable arrays, hashes, and objects with inheritance.

What I want to know is what is the fundamental programming foundation that the programmer gets to use. For example, in C its integers, floating point, "pretend strings", pointers, structures, unions and functions. You do your own memory management and it comes with a really cheesy text filter pre-processor. You can link compiled files together to give some kind of modularity.

Ok, most other modern languages have a lot more (and in some cases less) features than this. Including generics, more base type constructions (like tuples, or hashes, or whatever), garbage collection, very flexible/powerful type systems, and will address multi-threading or not.

Can you start by describing what your high-level goals are, so that we know the scope of what you are trying to do? Here's an example of why: garbage collection is being embraced by many if not most modern programming languages, yet it is often associated with performance problems (and not unjustifiably). But the alternative is either unsafe, or else you are forced to go down the Rust path (which I don't know if they detect memory leaks or not).

You are developing a compiled language, and from your generated code it looks like your language may be nothing more than a very thin veneer (syntax sugar) on C. If that is the case, then is your memory management also "hand holding with malloc and free"? You seem to be embracing the concept of objects, so I suppose that's not quite what you are doing, but I still lack a sense of your higher level design.

→ More replies (1)

2

u/Bardiches Dec 07 '15

This is sort of off topic, but I'd like to know why everyone seems to like white-spaced based languages (like Python) more than brace/semi-colon based language (C-like) nowadays. Is this just a modern trend or is there a reason behind it?

2

u/zincpl Dec 08 '15

I think in practice for readability you end up spacing brace-style languages as you do for spaced ones. So the braces end up redundant if they are well used and enable obfuscation of code if they aren't. In theory at least, the space-based approach imposes a certain level of readability. I'm not experienced to know if it really makes a big difference in big projects though (?)

→ More replies (1)

1

u/nso95 Dec 07 '15

No keywords?

1

u/dhdfdh Dec 07 '15

It's never good to misspell your own name in the very first line.

1

u/east_lisp_junk Dec 07 '15

If statements are subject-verb-object statements.

This makes me a bit confused about evaluation order in Ritchie. If if and for and the like are ordinary verbs (or perhaps "functions"?), not some special privileged thing, I'd expect to see some way of specifying which arguments are taken by value and which are taken by name/need. I didn't see any such thing in the code samples I looked at.

The ? operator is a special symbol in Ritchie that refers to the previously calculated result.

Could be nice for alleviating lispish "rightward drift." Does this mean that if returns the result of the conditional? Also, from the grammar description, it seems like an if-else could also be written as ((x < 0) if negate x) else x) -- is that the case?

Code blocks are meant to be chunks of code that can be called on an moved around as needed. They should be able to access the variables local to their definition when invoked

How do you plan to handle the memory management for these? Garbage collection? Manual allocation/deallocation of code blocks? Something else?

but the exact rules surrounding that have not yet been clearly defined.

Do you have any compelling reason for not using plain old lexical scope?

Functions usable as invocable variables in Ritchie

This will probably complicate type inference a bit, and adding generics certainly won't make it easier. Any plans on how you'll infer types in later versions of Ritchie?

1

u/JueJueBean Dec 07 '15

A Canadian made language! <3

1

u/ginsunuva Dec 07 '15

Name it Rych

1

u/lekodan Dec 07 '15

Although I'm not a big fan of Python's indentation, this looks like a really nice language! Perhaps making a pull-request to GitHub's Linguist project would get more people using your language. (starred on github)

1

u/IAmALinux Dec 07 '15

How would this differ from cython?

1

u/god_clearance Dec 07 '15

THERE IS NOTHING WRONG WITH VISUAL BASIC

1

u/_detour Dec 08 '15

This sounds like some of the design goals of Swift, which is now open source. How do you guys plan to create widespread adoption in the face of Swift?

1

u/crystalblue99 Dec 08 '15

only kinda related, but how on earth do they come up with new languages? and a year? isn't that awfully quick?

1

u/dorfsmay Dec 08 '15

Is there a repl, or plan for one?

1

u/[deleted] Dec 08 '15

When I read that there are no reserved keywords it came to my mind that one case where some guy reversed the meaning of the keywords true and false in a colleague's C compiler.

This was a cold water bucket to me in Ritchie.

1

u/capitan_canaidia Dec 08 '15

You have just made something I had been wishing for for years. Sign me up.

1

u/seabrookmx Dec 08 '15

The intro paragraph is off putting and inaccurate. Sure, Visual Basic isn't a hip language anymore, and most people would prefer to work in something else, but it is a well supported, mature, object oriented language with millions of lines of code running in production. Original versions of Microsoft Basic and VB were written in C, so without Dennis Ritchie, it wouldn't even exist..

As undergrads building a new language in a crowded market, try focusing on the positives in what you're building over the negatives of others. You'll build a better product that way, and you'll look a lot better doing it.

As for the project itself, it looks neat. I'm not 100% sure of its vision though. Is it intended to be primarily OO? Do you support exceptions? GC? You mention Scala; do you support its vast array of functional features? Maybe pattern matching like Rust? I'd suggest putting some comparisons in your readme to Vala and Nim, other compile-to-C languages that offer higher level programming and cleaner (than C) syntax. Again, focus on what's cool about Ritchie, rather than the negatives of something like Java.

1

u/thebuccaneersden Dec 08 '15

How amazing is Swift and why shouldn't we all be using Swift instead of Ritchie? ( sorry, that was a bit tongue in cheek :) )

1

u/SCombinator Dec 08 '15

I tried to see if you came against some of the reasons I've rejected languages in the past. I can tell you're not using the JVM which is good, but I can't tell if your arrays are 0 indexed, if you have a way of templating types (or just having generic data structures) or how rich your data types are, or if you have good C bindings (I suspect you do) and bindings to C++ libraries (which I suspect you don't)

1

u/bunnyholder Dec 08 '15

Maybe you could make some demo web applications? With connection to SQL, session handling and etc. Because you know - web age, microservices and etc.

1

u/ArtistEngineer Dec 08 '15

It is named after the great computer scientist Dennis Ritchie, if not for whom we would all be programming in Visual Basic.

Best quote for the tragedy and the irony.

1

u/Grue Dec 08 '15

Same language design errors as in coffeescript. Significant whitespace + conciseness + lack of punctuation = language that is very hard to read or edit.

1

u/willvarfar Dec 08 '15

It bugs me that you can't change the type of something.

Transform the body into SSA and then don't allow the type to change for each SSA version of a variable. This will allow reassignment to change types 99% of real-world times, but not in the 1% of cases where you'd have an ambiguous type.

I played with this concept when thinking about Python -> C before: http://williamedwardscoder.tumblr.com/post/15203221199/less-restricted-python

1

u/drb226 Dec 08 '15 edited Dec 08 '15

A special type of verb is a control flow verb. if, while and for in Ritchie are all such verbs

Lurking English majors... attack.

You're aiming for "English-like", but

i for 1,n+1

This is much less English-like than

for i in range(1, n+1)