TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

212 pointsby Growtikaover 2 years ago

29 comments

ibizaover 2 years ago
&gt; 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.<p>This is Rust&#x27;s calling-card, so I find this plea for a better lang &#x2F; eco rather jarring after dismissing Rust for somehow &quot;making the wrong tradeoffs&quot;.
评论 #33726819 未加载
评论 #33729299 未加载
评论 #33724892 未加载
评论 #33724193 未加载
评论 #33775733 未加载
评论 #33726478 未加载
aeturnumover 2 years ago
I&#x27;m really interested to see Jai in the wild, but I have to say I find the Jai v.s. Rust comparison here...unconvincing to say to least. It&#x27;s particularly funny to be excited about &quot;being able to do <i>anything</i> during compilation&quot; using Jai and then complain to that the #1 problem in programming is &quot;culturally tolerated and even encouraged complexity.&quot;
评论 #33727678 未加载
评论 #33725943 未加载
评论 #33721222 未加载
gavinrayover 2 years ago
It&#x27;s worth mentioning that DMD is a reference compiler and not meant as a production tool. DMD is for fast compile time during dev cycles and testing new language features early.<p>You&#x27;ve got the LLVM and GCC compilers for production.<p>The problem with lack of debug info on Windows in D is solved by using LDC with LLDB&#x2F;GDB to debug<p>You can also ask the compiler to emit CodeView debugging info if you want to stick with Microsoft stuff
评论 #33721749 未加载
评论 #33721349 未加载
评论 #33724180 未加载
评论 #33723550 未加载
chromatinover 2 years ago
I find the &quot;slow compile time&quot; complaint of D interesting; overall I find ldc2 to be one of the faster compilers out there. I suppose the combination of features and metaprogramming used by the author is responsible for the 3-minute compile times in debug mode. While jai is evidently expected to be substantially faster (author estimates 5 sec for this codebase???), other choices like Rust would be far, far slower than D.
评论 #33721094 未加载
评论 #33722081 未加载
poulpy123over 2 years ago
I&#x27;m not sure that if passing from a widely used language to a marginal language wasn&#x27;t a success why going from a marginal language to a totally obscure one will be
评论 #33727288 未加载
unwindover 2 years ago
As someone who is aware of jai but not at all following the development, do the terms of the closed beta the OP is in permit code to be shown?<p>I guess &quot;yes&quot;, it seems so pointless otherwise.<p>Would be very interesting to see e.g. &quot;here is how this (gnarly) C++ turned into beatiful jai&quot;, zoomed-in to actual code level.
评论 #33727721 未加载
评论 #33723897 未加载
stephc_int13over 2 years ago
I&#x27;d love to see more about Jai.<p>I don&#x27;t understand why they are not working in the open, this is a tool, not a game, input for a large community is extremely valuable.<p>But as brilliant as Jon Blow is, he is at least equally as stubborn.<p>Fast compilation and nice, easy to read syntax with good default is exactly what I am looking for.<p>I can understand the hype about metaprogramming, and its potential usefulness, but I also think this is a pandora box.<p>Pretty much like C macros and C++ templates, overuse can lead to a very messy codebase, hard to read, hard to debug, with a lot of unexpected side effects.
评论 #33721893 未加载
评论 #33723495 未加载
评论 #33723352 未加载
评论 #33723464 未加载
评论 #33722165 未加载
评论 #33725008 未加载
评论 #33725158 未加载
评论 #33727402 未加载
cleandreamsover 2 years ago
I wrote an extremely hard and complex program in which I had to use c++ metaprogramming throughout. Not my decision. I do not understand why you could possibly need more metaprogramming than C++ provides. This is a problematic feature to begin with. Not worthless but not worth much. The debugging was difficult. Many problems show up buried in literally thousands of compiler error messages.
评论 #33722920 未加载
评论 #33723416 未加载
评论 #33722903 未加载
andaiover 2 years ago
“In the beginning I hinted at expecting the porting process to go somewhat smoothly (which I’m sure I won’t regret later). The reason for this is that I have two systems in my game that will hopefully be immensely helpful in this endeavor:<p>- The game records the inputs (HID, loaded files, network, …) of a play-session into a file and replay them later. When replaying, feeding recorded input into the deterministic game loop leads to the exact same state, down to the bit.<p>- The game hashes game state at various points during execution and saves these hashes to a different file. When replaying, the contents of this file can be used to check that the execution of the replayed session exactly matches the original execution.”
dmitriidover 2 years ago
Can&#x27;t wait to see how this progresses. So far the only source of knowledge have been Blow&#x27;s streams, but he&#x27;s the author, and he knows his language inside and out. It will be immensely interesting to see other people&#x27;s experiences.
评论 #33723092 未加载
bachmeierover 2 years ago
&gt; there’s also the general feeling that the D creators’ vision of what a fixed C++ looks like is just vastly different from mine<p>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 &quot;fixed C++&quot;. So many times I have seen C++ programmers disappointed that D is not C++. On the other hand, if you&#x27;re a C programmer, you&#x27;ll probably be comfortable writing D code. I think of D and C++ as incompatible forks of C.
评论 #33726904 未加载
评论 #33727864 未加载
conaclosover 2 years ago
Fast compilation seems very appealing. It is one of the main reason why I am interested into Go and Zig.<p>I recently started working with Rust for contributing to projects like Rome&#x2F;tools [1] and deno_lint [2]. The compilation and IDE experience is frustrating. Compilation is slow. I am afraid that this is rooted to the inherent complexity of Rust.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;rome&#x2F;tools" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rome&#x2F;tools</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;denoland&#x2F;deno_lint" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;denoland&#x2F;deno_lint</a>
johnisgoodover 2 years ago
I hope the game will not end up like Limit Theory (<a href="https:&#x2F;&#x2F;www.kickstarter.com&#x2F;projects&#x2F;joshparnell&#x2F;limit-theory-an-infinite-procedural-space-game" rel="nofollow">https:&#x2F;&#x2F;www.kickstarter.com&#x2F;projects&#x2F;joshparnell&#x2F;limit-theor...</a>). They are similar, apart from the 3D and 2D part.
SevenNationover 2 years ago
&gt; The largest elephant in the room to address is probably Rust. ...<p>Breaking this down, I can only find two practical problems the author has with Rust:<p>- long compile times<p>- the ownership model (&quot;the borrow checker&quot;)<p>The rest of this paragraph appears to be much more general in nature.<p>Given that the project is only 58,000 lines of D&#x2F;C++, it&#x27;s hard to believe that compile time alone is so bad as to drive a decision toward an experimental language like Jai.<p>So it appears that the main problem the author has is the ownership model (&quot;the borrow checker&quot;). It would be interesting to know more, but the author does not elaborate.<p>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?
SilentLambdaover 2 years ago
&quot;That said, D definitely has some advantages over C++, like more powerful metaprogramming, no need for headers, no uninitialized values and more. But unfortunately, these upsides are outweighed by the downsides.&quot;<p>Yes, after working with D for far too long, I have decided to delete it off my computer and I&#x27;m going back to C++, where a class is still a first-class &#x27;type&#x27;, and a &#x27;value&#x27; type at that (at least by default).<p>In D, a class is a reference type only and worse, the D language has no means of declaring, let alone enforcing at compile time, a perimeter around such a type, within the so called &#x27;D module&#x27;. The entire D module is within the perimeter of your class type, at all times!
zengidover 2 years ago
&gt; <i>In my eyes, the most important ones are faster compilation and allowing metaprogramming via unrestricted compile time execution.</i><p>I&#x27;m fascinated by languages that are adding more compile-time programming features, in the context of a low-level performance-oriented use case. Would love to know more about the history and state of the art of this area.
评论 #33729028 未加载
pietmichalover 2 years ago
Very interesting! Apparently a lot of information on the Internet about the Jai language is outdated which makes me curious about the follow up post!<p>I don&#x27;t know if OP is the blog owner. If yes, I&#x27;d love to have an option to subscribe to an email list. I&#x27;ve installed an RSS feed but email is still my preference. Thanks!
haolezover 2 years ago
&gt; All information for building a program is contained within the source code of the program. Thus there is no need for a make command or project files to build a Jai program.<p>Ok, now I&#x27;m curious. Will have to check it out.
flykespiceover 2 years ago
I heard about this &quot;promising&quot; language as a youngster and never heard of it again, it doesn&#x27;t seem to have taken off after all these years, and probably it&#x27;s too later for it ever take off.
shp0ngleover 2 years ago
Where can I actually see more about Jai?<p>All I keep finding are youtube videos and twitch streams, which are the worst way for me to learn about a programming language. I guess it’s still not generally available?
tonethemanover 2 years ago
Hard to get much out of this since the language is not available to everyone.
Kukumberover 2 years ago
&gt; ldc2 is awfully slow to compile5<p>LDC = LLVM backend<p>it&#x27;s slow for D, for C++, for Zig and also slow for Jai<p>The reference compiler &quot;DMD&quot; is what you use to get fast iteration time<p>&gt; (jai) Reducing compile times from about 60s right now to under 5s, hopefully around 1s<p>Try to compile the DMD compiler and notice how fast it is at compilation<p>So that sounds like it&#x27;s a &quot;your code&quot; problem, my game engine takes 1.2 seconds to fully recompile with DMD<p>&gt; the documentation is lacking<p><a href="https:&#x2F;&#x2F;dlang.org&#x2F;phobos&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;dlang.org&#x2F;phobos&#x2F;index.html</a><p>Looks complete with exhaustive code examples that you can run online<p>&gt; Ok, so I don’t like D and C++ and jai looks good. But what about all the other languages?<p>Ok so that explains everything
smegsicleover 2 years ago
&gt; Porting 58k lines of D to C++ in Jail<p>and they call sprinkling a bit of water &quot;cruel and unusual&quot;
dymkover 2 years ago
I don’t understand how this language is planning on ever seeing adoption when it’s been restricted from open use since it’s inception. Seems like vaporware.
评论 #33722290 未加载
评论 #33721786 未加载
评论 #33721404 未加载
评论 #33721922 未加载
评论 #33724877 未加载
评论 #33723275 未加载
评论 #33722301 未加载
评论 #33721766 未加载
didipover 2 years ago
This person might as well said that he is not planning to finish his game.<p>Screwing around with tooling and languages seems to be a common pitfall to not finishing a game.<p>Why not just use the best ecosystem like Unreal&#x2F;Unity and get the game out of the door fast?
评论 #33723097 未加载
评论 #33722647 未加载
评论 #33724149 未加载
评论 #33722588 未加载
评论 #33722439 未加载
评论 #33723512 未加载
评论 #33723125 未加载
StreamBrightover 2 years ago
I am surprised by the design of jai. The author has very interesting view on typical programming problems (RAII, exceptions).
pizza234over 2 years ago
Putting together the available document &quot;JayPrimer&quot; (which may be obsolete) with the blog post, Jay it seems a language designed by somebody who&#x27;s was fed up with C++, and deciced to write their own, tailored language; this looks great when seen through the lens of C++, but there isn&#x27;t anything particularly innovative in the context of modern languages.<p>In particular, I&#x27;m personally neutral to Zig, but there seems to be little reason to prefer Jay over it.<p>From the primer:<p>&gt; Arbitrary Compile-Time Code Execution<p>This is the big selling point, but, brought to the extreme, it&#x27;s not necessarily a good thing. The examples in the primer are intended to look great:<p>- Insert build time data<p>- Download the OpenGL spec and build the most recent gl.h header file<p>- Contact a build server and retrieve&#x2F;send build data<p>but they&#x27;re the type of things that turn a build into a monster.<p>I guess comptime execution is big in the gamedev area (I can&#x27;t say, I have little experience), but I suppose Zig fits the typical gamedev use cases (curious to hear devs with hands-on experience).<p>&gt; Code Refactoring<p>The example presented seems to be &quot;extract to function&quot;, which sufficiently advanced IDEs should support. It&#x27;s also unclear if it&#x27;s currently implemented.<p>&gt; Integrated Build Process<p>I don&#x27;t see this as a good thing. It&#x27;s good from the perspective of old programming languages, whose build tools are a mess. But having a separate tool is actually an advantage, as long as it&#x27;s standardized and well integrated (I suppose modern languages have this support).<p>&gt; SOA AND AOS<p>This seems to be a very niche feature.<p>&gt; Reflection and Run-Time Type Information<p>This is very convenient, but again, nothing unique.<p>&gt; FUNCTION POLYMORPHISM<p>It seems to be an odd (flexible&#x2F;inferred) generics implementation. One of the language objectives is to never perform automated type casting, but in this example, it is performed.<p>&gt; THE ANY TYPE<p>I guess this is a polarizing feature.<p>&gt; STRUCT POINTER OWNERSHIP<p>Is this syntactic sugar for a C++ destructor?<p>&gt; Other Cool Stuff<p>&gt; Specific data types for 8, 16, and 32 bit integers<p>No 64&#x2F;128? :^)<p>Regarding the post, the non-trivial selling points are described as:<p>&gt; Reducing compile times from about 60s right now to under 5s, hopefully around 1s<p>This is certainly very appealing.<p>&gt; having debuggers work<p>Uh? That&#x27;s based on the bad D experience.<p>&gt; Replacing build-scripts with jai code<p>&gt; Catching more errors by introducing custom compilation checks using metaprogramming<p>&gt; Replacing complex metaprogramming code with simpler, imperative code<p>See Zig.<p>The rest are trivialities.
hesdeadjimover 2 years ago
I’m in the private beta and things are changing constantly. I’m not sure why anyone would pick a language that won’t ever have a real ecosystem of libraries. Coming from C++ and need to remain low-level? Pick Rust, done.
评论 #33723054 未加载
评论 #33727211 未加载
评论 #33725029 未加载
评论 #33727406 未加载
fefe23over 2 years ago
Please choose more descriptive titles for your submissions here, people.<p>Some dude I don&#x27;t know is porting a game I know nothing about to a language I know nothing about and his reason is &quot;because I feel like it&quot;. He has grievances about the current state of things and the port hasn&#x27;t gotten anywhere yet.<p>I have a hard time thinking of a blog post that would be less useful to me.<p>No lessons learned, no &quot;why you should consider this obscure programming language you have never heard anything about&quot;. Also you need to go to wikipedia to find out the programming language is targeted at games. Programming games is not one of my interests.<p>You&#x27;d think they at least explain why jai is good for programming games. But they don&#x27;t. The blog post can&#x27;t, in fact, because he hasn&#x27;t gotten far enough yet to draw any conclusions.<p>At least make it look like you are making an effort to not waste my time.
评论 #33726367 未加载
评论 #33727205 未加载
评论 #33727283 未加载