News for hackers. Stuff that matters.
Re:Ritchie language: power of C and convenience of a high-le... by andrewchambers on Monday December 07, 2015 @06:41PM (#10693670)
Looks cool.

My advice to the authors is to take care on the little things. For example, the compiler segfaults if there is no input and there is no message if RITCHIE_HOME isn't set. Fixing those things early will increase the feeling of polish and will probably help keep quality high to the very end.

Re:Ritchie language: power of C and convenience of a high-le... by 6502nerdface on Monday December 07, 2015 @05:31PM (#10693273)
> There are five core principles behind Ritchie: ... No reserved keywords, everything is redefinable.

Why is this a principle? What advantage does it confer? My initial reaction is that this will result in nightmarish code.

Re:Ritchie language: power of C and convenience of a high-le... by nostrademons on Monday December 07, 2015 @06:03PM (#10693469)
Makes it easy to build EDSLs. Very often, in an EDSL you want your users to be able to use a language that's almost like the host language, but has one or two key constructs redefined.

I'm not sure it's the choice I would've made, but I can see it being very attractive for someone whose primary experience with programming is designing a programming language. Back when I was interested in PL design in college, I was a big fan of this property in languages as well.

Re:Ritchie language: power of C and convenience of a high-le... by vorg on Tuesday December 08, 2015 @12:12AM (#10694933)
When there's a close match between a lexical rule and a semantic rule, it's easier to remember how to use the semantics.

Most languages have an arbitrary rule for distinguishing between an identifier (it begins with letter, except for 30 to 80 special cases) and keyword (30 to 80 special cases) which is hard to remember. When the rule is that the first character of an alphanumeric sequence determines whether it references a number (it begins with digit) or identifier (it begins with letter), that's easy to remember. Golang extends that idea by also distinguishing between public (beginning with uppercase) and private variables in this way, but it still falls short on its rule for recognizing the 50-odd keywords and special identifiers.

Languages that have simple lexical-semantic matches enable people to program in it without IDE's or other crud.

Re:Ritchie language: power of C and convenience of a high-le... by blacksqr on Monday December 07, 2015 @09:05PM (#10694307)
See e.g. FORTRAN.
Re:Ritchie language: power of C and convenience of a high-le... by efferifick on Monday December 07, 2015 @10:44PM (#10694648)
Can someone explain the advantage of compiling to C instead of compiling to LLVM-IR? I have seen more languages that compile to C than to LLVMIR. It seems to me that there are a lot of advantages in using LLVM but I fail to see the advantages of compiling to C.

Thanks

Re:Ritchie language: power of C and convenience of a high-le... by andrewchambers on Monday December 07, 2015 @11:23PM (#10694792)
Compiling to llvm brings a giant complicated build time dependency and it is not pleasant to emit it as plain text due to some strange design decisions.

People are also more familar with C, it works on more platforms, and doesn't require any familiarity with SSA.

I think you only really need llvm when you want to get into debug symbols.

Re:Ritchie language: power of C and convenience of a high-le... by srean on Tuesday December 08, 2015 @01:14AM (#10695087)
As a targets both C and LLVM-IR are quite popular, but I really wish there was a mature target that enabled efficient coroutines cleanly and _portably_. C exposed pretty much every low level extraction of the underlying machine model but left out stack switching, which the PDPs were very capable of.
Re:Ritchie language: power of C and convenience of a high-le... by Veedrac on Monday December 07, 2015 @07:08PM (#10693818)
I don't like the benchmark grid given.

It's not hard to use fewer characters than Python if you add superfluous parentheses and don't use any of its higher-level features. Rewriting the Python code to be roughly idiomatic shaves off a good 100 characters, even without noticeably changing the algorithm, and that's even with adding some newlines and the indentation cost that entails.

And, IMHO, saving bytes by not having a #! or by using "1" over "True", or even "->" over "return, doesn't impress me much.

Re:Ritchie language: power of C and convenience of a high-le... by ilek on Tuesday December 08, 2015 @05:04AM (#10695605)
I don't see why it's <condition> if <statement> and so on.

Seems they want to be SVO just for the sake of it, and not because it's actually a good idea.

For something that wants type safety like Scala, they don't seem to have put much thought into their type system which is pretty fundamental.

Statements like point = Point x, y is confusing. Is it the same as Point (x), y?

Respect either way however, not many people even get to this point with their own language.

Re:Ritchie language: power of C and convenience of a high-le... by fenollp on Tuesday December 08, 2015 @04:34AM (#10695528)
> type inferred when they are first used and their type cannot be changed after that

So, where is the power of C? Where is my void*?

> if, while and for in Ritchie are all such verbs. They are not keywords, as you can redefine them, although this is probably not a good idea.

This is the worst idea. Have you heard of C++? Are you really going to read someone else's code ever?

> Ritchie is whitespace sensitive

I am mixed on this. I think it works great with Python and Haskell, but is terrible with Ruby…

Re:Ritchie language: power of C and convenience of a high-le... by phantom_oracle on Monday December 07, 2015 @05:06PM (#10693096)
Wow, so it finally happened.

The beauty of Python meets the power of C.

I do hope this project lives long and is not abandoned beyond the students final years at college.

Re:Ritchie language: power of C and convenience of a high-le... by p4wnc6 on Monday December 07, 2015 @06:02PM (#10693459)
Julia and Cython are just two of the languages that already achieve this (albeit with their own warts and bumps) and from what I see at the Ritchie page, I think I'll stick with those.

BTW -- speaking as someone who first learned to program in a dynamically typed language and only later saw the beauty of static typing, I would strongly debate the idea that type inference everywhere is a good thing. The benefit of strict static typing is not so much that it allows a compiler to produce fast code -- there are lots of ways to achieve that. The benefit is that by forcing the programmer to type out the type signatures of functions in advance, you force a level of thought clarity and appreciation for the way that different pieces of code have to pass off data or state to other parts. I find it leads to better software not because of the compiler (although a compiler catching your mistakes is great for productivity), but because it makes you think much more clearly.

It's sort of like the habit of writing down your moves in chess. The benefit is that it creates a ritual of thought and reflection, and potentially makes you more careful.

These days, I see code with enforced type declarations and typed signatures as so much more elegant than similar code that, while having fewer characters, conveys significantly less about the programming intention. Those extra characters for type info are not clutter, not by a long shot.

Re:Ritchie language: power of C and convenience of a high-le... by sanderjd on Monday December 07, 2015 @07:15PM (#10693854)
I find that specifying parameter types, encouraging pure functions, and encouraging small functions is the best formula to be able to reason locally about code, which I think is one of the most powerful abilities in order to not be overwhelmed by large and complicated projects. I find myself increasingly drawn toward languages and frameworks that encourage this sort of programming. Fortunately, I seem to be in agreement with many language and framework authors these days, and I'm really excited about the landscape over the next few years.
Re:Ritchie language: power of C and convenience of a high-le... by dinedal on Monday December 07, 2015 @05:27PM (#10693239)
Some of the current open issues worry me, this is a very very early stage project.

I will keep an eye on it and wish it the best, but I feel like Nim is still my go to (pun not intended) for "C speeds but not C level"

Re:Ritchie language: power of C and convenience of a high-le... by rubiquity on Monday December 07, 2015 @05:34PM (#10693303)
Nim was the first language that popped into my mind as well when I read "The beauty of Python meets the power of C."
Re:Ritchie language: power of C and convenience of a high-le... by J_Darnley on Monday December 07, 2015 @06:02PM (#10693464)
> The beauty of Python

> Ritchie is whitespace sensitive

As I thought. No thanks.

Re:Ritchie language: power of C and convenience of a high-le... by girvo on Monday December 07, 2015 @07:30PM (#10693938)
Y'know, I used to feel the same way. But using a decently configured Vim or Atom, programming in Nim (which is white-space sensitive) has been perfectly fine. Not good, not bad, it just _is_. The language itself is great, too.
Re:Ritchie language: power of C and convenience of a high-le... by duaneb on Monday December 07, 2015 @07:08PM (#10693817)
If you're still getting stuck up on semantic whitespace in 2015, you must not use any of:

+ Python + Haskell + Javascript + Go + Ruby + Bash

Anything else I'm missing? Whitespace is useful. Figure out how to view it in your editor and move on already. This is so far beyond bike-shedding it's just a depressing comment on how much programmers obsess on syntax.

Re:Ritchie language: power of C and convenience of a high-le... by SamReidHughes on Monday December 07, 2015 @09:04PM (#10694304)
Line endings are a different question than indentation.

Language design decisions do matter. "Figure out how to view it in your editor" doesn't do one lick to address the problems of semantic indentation.

Re:Ritchie language: power of C and convenience of a high-le... by J_Darnley on Monday December 07, 2015 @08:17PM (#10694131)
God no. Most of those hold no value or any interest for me. Bash only because it is the default shell. And thanks for pointing out why I should avoid the others.

Have you never looked at a diff? Massive whitespace changes hide real changes. Next someone will say "Git has a -w option". To which I say "A diff without whitespace changes in those languages would be useless". I can't test it, apply it, or otherwise use it without re-indenting the source myself.

Re:Ritchie language: power of C and convenience of a high-le... by adrusi on Monday December 07, 2015 @10:59PM (#10694703)
Significant-whitespace languages don't introduce any additional whitespace changes because most people keep their code in whitespace-agnostic languages neatly indented anyway.
Re:Ritchie language: power of C and convenience of a high-le... by J_Darnley on Monday December 07, 2015 @11:23PM (#10694793)
Then I guess you don't work on any projects that only want to see non-whitespace changes.
Re:Ritchie language: power of C and convenience of a high-le... by nostrademons on Monday December 07, 2015 @07:20PM (#10693893)
Swift, where semicolons are optional unless you have multiple statements on the same line.

Also C++, C99, and Java if you count // comments.

Re:Ritchie language: power of C and convenience of a high-le... by jason_s on Monday December 07, 2015 @07:20PM (#10693895)
? How does Javascript use semantic whitespace?
Re:Ritchie language: power of C and convenience of a high-le... by omaranto on Monday December 07, 2015 @07:57PM (#10694039)
I'm not sure of the details but surely the answer involves semi-colon insertion.
Re:Ritchie language: power of C and convenience of a high-le... by Turing_Machine on Monday December 07, 2015 @09:09PM (#10694320)
That's the only one I'm aware of.

Put me in the "if that makes a difference in your code, you're doing it wrong" camp (and yes, I recognize that not everyone agrees, and that argument has already been had too many times).

Re:Ritchie language: power of C and convenience of a high-le... by jason_s on Monday December 07, 2015 @07:22PM (#10693907)
.kniht uoy naht tnatropmi erom s'ti spahrep os ytilibadaer stcapmi xatnyS
Re:Ritchie language: power of C and convenience of a high-le... by chm on Monday December 07, 2015 @06:56PM (#10693750)
I also don't see the interest, but with a decent editor this shouldn't be a problem. For the little Python I write, Vim takes care of formatting the code.
Re:Ritchie language: power of C and convenience of a high-le... by restalis on Tuesday December 08, 2015 @01:04PM (#10698123)
Wouldn't you agree that the code inspection should be easy enough to be performed without fancy tools? It's good to empower yourself with tools to make oneself more efficient but I can't see any compelling reason for us to rely on them so much that we could not do without!
Re:Ritchie language: power of C and convenience of a high-le... by pspeter3 on Monday December 07, 2015 @05:58PM (#10693439)
The Subject Verb Object language design is a really interesting way to parse and understand code.
Re:Ritchie language: power of C and convenience of a high-le... by sritchie on Monday December 07, 2015 @06:07PM (#10693488)
speaking as a Ritchie, I wholeheartedly approve.