Live data from Hacker News

Focus: A simple and fast text editor written in Jai

github.com

51–60 of 105 posts

Re: Focus: A simple and fast text editor written in Jai

#51
post #37

This is meant as more of a general comment than to critisize this editor: I fail to see the selling point of an editor that "can't do much", but is performant - there is an abundance of these already. If you made an editor that does "everything" and is "fast", I may be interested. Regarding Jai: the idea about a "language for good programmers" is just about the worst thing ever to say about a language and it's commun…

GO was named a language for bad (not experienced) programmers by its creator. I don't see why doing the reverse of that automatically egregious I mean sure, people are in general hesitant when someone calls himself good, and for a decent reason. But pushing it to extreme and defaulting to reverse JUST BECAUSE someone dared to call himself good is also a pretty childish reaction. At the end of the day it is a fact tha…

I think the original point was misunderstood/twisted over time.

TL;DR Inexperienced != Bad

"The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt."

What Pike meant is that a company (e.g. google) cannot hire only people who have deep understanding in subtleties of advanced programming language theory and had the time to go through a long learning curve to actually reap the benefits of these advanced programming languages.

These young engineers are not bad, quite the opposite they are usually bright and brilliant young engineers

The problem with that kind of people is that they will use their cleverness to build complicated and beautiful stuff, but when combined with a lack of true and deep experience due to them being still young, this can become counterproductive.

Re: Focus: A simple and fast text editor written in Jai

#52
post #36
post #31

Earlier quoted context omitted.

Cpp goes nowhere to this level. Jai templates execute normal code (any code) at compile time, so there is no need for sfinae tricks or others, you just write code that directly deals with types. You can do things like having structs remove or add members by just putting the member behind an if branch. You can also fully inspect any type and iterate members through reflection. There is a macro system that lets you man…

That sounds interesting; seems to be even more flexible than comptime in Zig, almost as powerful as Lisp and the MOP. How about compiler and runtime performance of these features? EDIT: can you point to source locations in the referenced projects which demonstrate such features?

https://pastebin.com/VPypiitk This is a very small experiment i did to learn the metaprogramming features. its an ECS library using the same model as entt (https://github.com/skypjack/entt). In 200 lines or so it does the equivalent of a few thousand lines of template heavy Cpp while compiling instantly and generating good debug code.

Some walkthrough:

Line 8 declares a SparseSet type as a fairly typical template. its just a struct with arrays of type T inside. Next lines implement getters/setters for this data structure. Note how std::vector style dynamic array is just a part of the lang, with the [..] syntax to declare a dynamically sized array.

Line 46 Base_Registry things get interesting. This is a struct that holds a bunch of SparseSet of different types, and providers getters/setters for them by type. It uses code generation to do this. The initial #insert at the start of the class injects codegen that creates structure members from the type list the struct gets on its declaration. Note also how type-lists are a native structure in the lang, no need for variadics.

Line 99 i decide to do variadic style tail templates anyway for fun. I implement a function that takes a typelist and returns the tail, and the struct is created through recursion as one would do in cpp. Getters and setters for the View struct are also implemented through recursion

Line 143 has the for expansion. This is how you overload the for loop functionality to create custom iterators.

The rest of the code is just some basic test code that runs the thing.

Last line does #import basic to essentially do #import stl type thing. Jai doesnt care about the order of any declarations, so having the includes at the bottom is fairly common.

Re: Focus: A simple and fast text editor written in Jai

#53
post #42
post #12

Jai is an amazing language to work with, I highly recommend checking it out once it becomes publicly released. It's elegant, simple, performant, takes all the best parts of Zig minus the annoying parts (like errors on unused local variables) and adds a bunch of super useful game development libraries as well as a built-in string type (which I really missed in Zig). Oh, and the compile times are just a joy, almost no…

What is annoying with errors in Zig?

I don't think they can carry information.

Re: Focus: A simple and fast text editor written in Jai

#54
post #51
post #37

Earlier quoted context omitted.

GO was named a language for bad (not experienced) programmers by its creator. I don't see why doing the reverse of that automatically egregious I mean sure, people are in general hesitant when someone calls himself good, and for a decent reason. But pushing it to extreme and defaulting to reverse JUST BECAUSE someone dared to call himself good is also a pretty childish reaction. At the end of the day it is a fact tha…

I think the original point was misunderstood/twisted over time. TL;DR Inexperienced != Bad "The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language th…

Sure, 'good' and 'bad' are inherently (too) simplistic descriptions. But imo, if we take the context in which J. Blow calls himself (and user of his language) "good" programmers in good faith, then it would be natural to call those fresh googlers 'bad' (again, in the same context of meaning for 'good' and 'bad'). Not because they are inherently worse people and aren't talented - but simply because the reason you state yourself - they just don't have the experience to tread the fine line of using a super powerful language "properly" (YET).

Re: Focus: A simple and fast text editor written in Jai

#55

This is meant as more of a general comment than to critisize this editor: I fail to see the selling point of an editor that "can't do much", but is performant - there is an abundance of these already. If you made an editor that does "everything" and is "fast", I may be interested. Regarding Jai: the idea about a "language for good programmers" is just about the worst thing ever to say about a language and it's commun…

I always interpreted Jon Blow “good programmer” = “cares about the craft”. Someone that knows deeply the tech stack and understands the tradeoffs made for each decision as opposed to those that just follow fashions and dogmas without evaluation (Object oriented, garbage collection, web framework du jour…). That’s my interpretation after following Jon for a while. could be wrong.

Re: Focus: A simple and fast text editor written in Jai

#56
post #29

Earlier quoted context omitted.

Innovation is good. There is a tradeoff between the benefit of choice and waste. Duplication is a good candidate for waste.

I think it's not up to us, the peanut gallery, to judge what any particular developer spends their time on. It's worthwhile to Blow, and he is very vocal that he is developing the language for his own use, not for anyone else. If you keep that in mind, maybe some of the choices around how it's being developed will make more sense.

I'm a language implementor myself and just asked for a clear unique selling point of Jai, and guess what, there was indeed one fellow here who didn't question the question, but has personal experience and was able to give me the information I was interested in (see https://news.ycombinator.com/item?id=37369342), without me having to read or listen through dozens of outdated blog posts and presentations. I still think a language specification would be worthwhile, even during early development.

Re: Focus: A simple and fast text editor written in Jai

#57
post #52
post #36

Earlier quoted context omitted.

That sounds interesting; seems to be even more flexible than comptime in Zig, almost as powerful as Lisp and the MOP. How about compiler and runtime performance of these features? EDIT: can you point to source locations in the referenced projects which demonstrate such features?

https://pastebin.com/VPypiitk This is a very small experiment i did to learn the metaprogramming features. its an ECS library using the same model as entt ( https://github.com/skypjack/entt ). In 200 lines or so it does the equivalent of a few thousand lines of template heavy Cpp while compiling instantly and generating good debug code. Some walkthrough: Line 8 declares a SparseSet type as a fairly typical template.…

Great, thanks!

Re: Focus: A simple and fast text editor written in Jai

#58
post #38
post #36

Earlier quoted context omitted.

That sounds interesting; seems to be even more flexible than comptime in Zig, almost as powerful as Lisp and the MOP. How about compiler and runtime performance of these features? EDIT: can you point to source locations in the referenced projects which demonstrate such features?

Dunno about runtime performance, but compiling speed is something that's regularly mentioned as an important aspect of Jai and I think it's not an exaggeration to name it as one of the fastest languages when it comes down to comp speed.

Do you happen to have measurement results?

Re: Focus: A simple and fast text editor written in Jai

#59
post #54
post #51

Earlier quoted context omitted.

I think the original point was misunderstood/twisted over time. TL;DR Inexperienced != Bad "The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language th…

Sure, 'good' and 'bad' are inherently (too) simplistic descriptions. But imo, if we take the context in which J. Blow calls himself (and user of his language) "good" programmers in good faith, then it would be natural to call those fresh googlers 'bad' (again, in the same context of meaning for 'good' and 'bad'). Not because they are inherently worse people and aren't talented - but simply because the reason you stat…

I disagree. The context that Jon uses is bad = careless, good = careful in the sense that I will make sure I deallocate my pointers.

Pike's argument is not about new hires being careless or incapable of writing tests or understanding dangling pointers and all that stuff.

The whole thing about memory safety is an external requirement to the whole discussion that Pike was starting. At the time it was already well understood that most security vulnerabilities at Google were caused by bugs around memory accesses and that even the most experienced engineers weren't immune to those.

What Pike was talking about was: among the solution space of programming languages that can address those issues, some require a lot of training, whole others are simpler to pick up and yet "good enough".

Rust is an example of a language that is solving the problem in a way that doesn't give up performance, but it does require a steeper learning curve. Pike argued that Google would benefit from a language that would require such a learning curve.

The tradeoff will change with time. Now that rust exists an argument can be made that there is sufficient learning already spent

Re: Focus: A simple and fast text editor written in Jai

#60
post #56

Earlier quoted context omitted.

I think it's not up to us, the peanut gallery, to judge what any particular developer spends their time on. It's worthwhile to Blow, and he is very vocal that he is developing the language for his own use, not for anyone else. If you keep that in mind, maybe some of the choices around how it's being developed will make more sense.

I'm a language implementor myself and just asked for a clear unique selling point of Jai, and guess what, there was indeed one fellow here who didn't question the question, but has personal experience and was able to give me the information I was interested in (see https://news.ycombinator.com/item?id=37369342 ), without me having to read or listen through dozens of outdated blog posts and presentations. I still thin…

From what I understood from Blow, a specification at this point would only serve to have other people bike shed about syntax, features, etc.

Looking at the explanation you linked, I would say that the author uses the language in a very unidiomatic way (if idiomatic Jai would be a thing :D). It takes a very template focused mindset and uses the features of the language to bastardize and complicate things needlessly (IMHO, as a not game developer). I think my main take away from the language is that it focuses on the way memory is mapped (similarly to how C does it) and less on behaviour associated with that memory.

So for that example, instead of trying to overthink a container that uses a generic behaviour through templated types, it would implement different overloaded functions for each type as needed.

Post reply on HN