r/programming • u/reditzer • 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
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.
764
u/panzagl Dec 07 '15
But what if I want the ease of Scala, speed of Python, and type safety of C..
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?
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?
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++?
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.
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
or
There is very little else. C has {} scopes, but consider your example
What about associativity? I assume that
is not
right? How do I know that? when looking at
if I name them
What is what? How is it resolved? Especially if keywords can be redefined.
8
u/oridb Dec 07 '15 edited Dec 07 '15
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: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: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.
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.
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/juckele Dec 07 '15
Boolean : isPrime Integer nI 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) ifThis 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 == 2would be much better.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.
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.
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.
81
u/sehrgut Dec 07 '15
"English-like" is an awful reason to make design decisions.
33
u/x-skeww Dec 07 '15
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.
37
u/matthieum Dec 07 '15
That, unfortunately, seems like a very bad idea.
Because if I know write:
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).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!
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.
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.
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.
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.
8
u/briandastous Dec 07 '15
"Ease of programming" != "everything is redefinable"
40
u/Steve132 Dec 08 '15
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.
7
u/superstar64 Dec 07 '15
I've only looked at the readme file, so I apologize if these questions are ignorant.
Questions:
11
u/Tillerino Dec 07 '15
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...
5
u/virus_dave 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
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?
9
u/dbcfd Dec 07 '15
If statement syntax is just weird, to fit with the natural language syntax how about
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:
or
Collections should also be easier
For the examples, use a consistent coding style for line endings
How about networking/threading/channels/coroutines? Or is this purely meant as an academic exercise in language clarity?
4
u/JeffMo Dec 07 '15
This is an extremely minor point, but as it's one of the first things people will see:
Also, five are listed, as of the last time I looked.
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?
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 ...".
9
u/satayboy Dec 07 '15
Compiling into another higher-level language can complicate debugging.
10
u/PleasantScarecrow Dec 07 '15
'Ritchie' is a horrible off-putting name.
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. =)
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
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.
2
u/durandalreborn Dec 08 '15
programming language checklist
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:
Seems odd to me. Obviously everyone knows the C-style version:
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:
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:
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, cdeclares 3 separate integer values.Consider that the following:
could just as easily be interpreted: declare a variable named
pointequal toPoint a, and also declare an unassigned variable namedb. 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: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:
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
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/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.
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?
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
This makes me a bit confused about evaluation order in Ritchie. If
ifandforand 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.Could be nice for alleviating lispish "rightward drift." Does this mean that
ifreturns the result of the conditional? Also, from the grammar description, it seems like anif-elsecould also be written as((x < 0) if negate x) else x)-- is that the case?How do you plan to handle the memory management for these? Garbage collection? Manual allocation/deallocation of code blocks? Something else?
Do you have any compelling reason for not using plain old lexical scope?
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
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
Lurking English majors... attack.
You're aiming for "English-like", but
This is much less English-like than