Live data from Hacker News

Porting 58k lines of D and C++ to Jai

yet-another-blog.com

171–180 of 264 posts

Re: Porting 58k lines of D and C++ to Jai

#171
post #73
post #10

Earlier quoted context omitted.

I don't think "DMD is a reference compiler and not meant as a production tool" is a great way to characterize it. There are certainly valid reasons for choosing LLVM and GCC for "production", but also valid reasons for choosing DMD.

As far as I know, DMD doesn't offer much optimisations. So you use DMD for development, and once the testing is done, built the production release with LDC or GDC.

DMD does do all the basic data flow analysis optimizations, along with register allocation by coloring, etc.

The problem is there are just a ton of special cases needed to generate good code, especially with the x86 instruction set which is nothing but special cases . Doing these takes a lot of developer time, one by one.

Re: Porting 58k lines of D and C++ to Jai

#172

> there’s also the general feeling that the D creators’ vision of what a fixed C++ looks like is just vastly different from mine I have emphasized for years that D is not C++. It can be used as a replacement for C++, in the sense that it does the same things, but it is not accurate to call it a "fixed C++". So many times I have seen C++ programmers disappointed that D is not C++. On the other hand, if you're a C prog…

> So many times I have seen C++ programmers disappointed that D is not C++.

More generally, every time I learn a new language, it is always frustrating, because I cannot write the same thing in the new language that I was used to writing in the old. It takes time until one starts thinking in terms of the new language, and only then will the frustration fade.

Re: Porting 58k lines of D and C++ to Jai

#173

Earlier quoted context omitted.

That's the issue with C++ metaprogramming. It's so unwieldy and complex that the benefits are difficult to see and the occasions to be worthwhile limited. When the language has better (i.e. simpler) facilities for meta-programming like D, it will open big venues where it makes sense to use it. It is like programming object oriented in C, it is possible to do but so unwieldy and requiring discipline and verbose boiler…

I disagree. Object-oriented programming is very easy in C even though the syntax itself doesn't guide you. Essentially, all C code I write is object-oriented. Perhaps you are thinking about dynamic dispatch which indeed is very annoying to implement correctly in C?

[deleted]

Re: Porting 58k lines of D and C++ to Jai

#174
> The largest elephant in the room to address is probably Rust. ...

Breaking this down, I can only find two practical problems the author has with Rust:

- long compile times

- the ownership model ("the borrow checker")

The rest of this paragraph appears to be much more general in nature.

Given that the project is only 58,000 lines of D/C++, it's hard to believe that compile time alone is so bad as to drive a decision toward an experimental language like Jai.

So it appears that the main problem the author has is the ownership model ("the borrow checker"). It would be interesting to know more, but the author does not elaborate.

AFAICT, the Rust compiler can be viewed as enforcing the good practices that C++ developers already recognize. So how can this be an issue at all, especially given the ability break out of the ownership model into unsafe Rust (or use other tricks) if the situation calls for it?

Re: Porting 58k lines of D and C++ to Jai

#175
post #158
post #133

Earlier quoted context omitted.

Unity is still written in C++. It's fairly common to write the core engine in C++ and use a language like Lua, or as is more common in AAA, some proprietary scripting language for gameplay code.

Interesting. I heard the Civilization games were Lua, didn’t know that was more common.

This kind of thing in general is very common and goes back decades, it's just that the languages used to be custom (QuakeC, UnrealScript etc) before the industry largely standardized around Lua. Some older games also experimented with Python for this, and I recall even seeing Tcl once.

Re: Porting 58k lines of D and C++ to Jai

#176
post #108

> a big chunk of these vulnerabilities would not exist if C and C++ [...] simply didn’t have zero-terminated string, initialized values by default, had a proper pointer+length type thus replacing 90% of pointer arithmetic with easily bounds-checkable code, and had established a culture that discouraged the prevalent ad-hoc style of memory management. This is Rust's calling-card, so I find this plea for a better lang…

This is also C++20’s calling card. It has `std::span`.

Spans/slices are getting incredibly common in as a fundamental building block in modern (or modernized PLs). C# also has Span, Go and Rust both have slices etc. We are at the point where they should be standardized on ABI level, IMO, before things get too messy compatibility-wise.

Re: Porting 58k lines of D and C++ to Jai

#177
post #62

Earlier quoted context omitted.

Could you give an examples of a game that used a custom game engines that couldn’t achieve what they wanted in Unreal or Unity? Edit: The only style I would think would be infinite/strange geometry, like Manifold garden (great game!). But, it’s Unity.

I've worked on several. You haven't heard of them because none of them shipped due to issues with commercial engines (in particular Unreal Engine 4). They are very difficult to use if the game play semantics are complicated and require lots of interaction with world state or world geometry. If you're making a common FPS, they are great.

> They are very difficult to use if the game play semantics are complicated and require lots of interaction with world state or world geometry.

Could you give an example? I’m trying to understand what the limits look like. It appears to be trivial to you, but for someone outside of game design, I can’t imagine what those might be.

Re: Porting 58k lines of D and C++ to Jai

#178

Earlier quoted context omitted.

That’s fair, but if you look at his posts about the language, he also makes a big point about how he doesn’t want any input from people with an academic background in language & type theory. This smells like anti-intellectualism to me. I’m a bit concerned that some of the decisions that he’s making in the language are leading towards traps that have caught other language designers in the past, but because he’s reject…

I think his disdain towards academia isn't really anti-intellectualism (he's not ignorant of compiler theory knowledge, otherwise he wouldn't have been able to write a compiler from scratch in the first place! And his interest in programming languages seems to span decades, from what I remember from one of his streams). I think he's critical of the fact that the primary focus of academia and industry in computer scie…

It looks exactly like anti-intellectualism to me.

Actually that's probably under-selling the problem. It's not just that Jon doesn't value the opinions of academics, he doesn't really value the opinions of anyone except Jonathan Blow.

Which is probably a healthy way to attack your first video game project, it's not as though Braid would be more likely to be a success if Blow stopped believing in it himself. But I would be surprised if that's true of a programming language.

> most academic CS works haven't really helped developers in building better programs and tools

It's doubtless possible to measure "most works" and "really helped" in ways which allow you to either draw this conclusion, or not, as you prefer but I don't think that's a useful way to think about it at all.

Re: Porting 58k lines of D and C++ to Jai

#179
post #112

Earlier quoted context omitted.

If you can find very old Jai videos on YouTube, you can find the creator of Odin was one of the early people excited about the project. I suppose if the development of Jai was made more in the open/public, Odin would probably not have existed. That said, I'm glad Odin exists.

You can find the creator of Zig in those videos as well

I think that even if Jai didn't directly inspire Odin and Zig, seeing Jon's enthusiasm for his new language influenced GingerBill and Andrew Kelley in their work. This is only the conjecture of someone on the side, but the timeline fits pretty well in my opinion.

Re: Porting 58k lines of D and C++ to Jai

#180
post #156

Please choose more descriptive titles for your submissions here, people. Some dude I don't know is porting a game I know nothing about to a language I know nothing about and his reason is "because I feel like it". He has grievances about the current state of things and the port hasn't gotten anywhere yet. I have a hard time thinking of a blog post that would be less useful to me. No lessons learned, no "why you shoul…

Geez, just do some web searches. Or ignore it, and find an article on subjects you already know.

I've been following D and Jai for years and found this really well written and interesting. Just depends on your background knowledge.

Post reply on HN