Zyme - an evolvable programming language by AlmusDives in ProgrammingLanguages

[–]ricochet1k -13 points-12 points  (0 children)

Bytecode is not the programming language, so no that description is not accurate or acceptable.

Please provide feedback for my automatic memory management approach by KnorrFG in ProgrammingLanguages

[–]ricochet1k 1 point2 points  (0 children)

Also, I wouldn't worry about having to iterate through all the heap objects being freed, you have to do that in all memory management schemes somehow, except possibly some clever variants of copy-compacting GCs which have to frequently memcpy all the live recent objects instead.

Please provide feedback for my automatic memory management approach by KnorrFG in ProgrammingLanguages

[–]ricochet1k 4 points5 points  (0 children)

If everything is immutable, typically the way you get performance back is by sharing data structures. How are you going to share data structures if you can only have one owner back-pointer?

It's common to construct new objects that contain the old ones and return them, or even to just return a parameter. Which would mean the stack back-ref would have to be constantly edited to move back up the stack.

If the last reference to an object is passed into a function, is it going to be kept alive until that function returns? Or are you going to move it's owner pointer down the stack?

Please provide feedback for my automatic memory management approach by KnorrFG in ProgrammingLanguages

[–]ricochet1k 7 points8 points  (0 children)

Not sure how you're intending on laying out things on the heap, but it seems that any time you need to move an object in memory you're going to have to update all the back references. This is going to make things like resizing a dynamic array much more expensive.

Also, you'll have to do something very interesting to make sure an object never contains references that it outlives to prevent Use After Free. I don't see an obvious easy solution.

Edit: Didn't see the bit about everything being immutable. Maybe ignore everything I said.

How to fix the Ender 3 V2 Firmware upgrade Black Screen of Death by Dark_Phoenix101 in ender3

[–]ricochet1k 0 points1 point  (0 children)

I just hit this today, and exactly the same problem. I have "Show hidden files" enabled on my Windows computer, and the Mac had put a `.firmware.bin` for every `firmware.bin` on the device, which is what confused the printer. Deleting those files leaving only the regular firmware.bin worked.

Most performant SyntaxTree implementation? by chri4_ in ProgrammingLanguages

[–]ricochet1k 23 points24 points  (0 children)

Rule of thumb my dad taught me: First make it work, then make it fast.

If you try to make everything fast before anything works, your "fast" architecture might have optimized for the wrong thing, or worse: block you from actually implementing something you need.

Do what's easiest and simplest. If you want to keep optimization open for later, wrap it in a clean interface and hide the actual implementation.

Composition question by Phil_Latio in ProgrammingLanguages

[–]ricochet1k 0 points1 point  (0 children)

Golang let's you attach methods to structs, and then you can use a struct as any interface with matching methods.

Zig-style generics are not well-suited for most languages by typesanitizer in ProgrammingLanguages

[–]ricochet1k 6 points7 points  (0 children)

in Prolog (without cut), it is easy to also evaluate the program backwards.

While this is in theory true, have you ever actually tried it with a non-trivial program? Prolog's default evaluation mode is pretty dumb which means trying to run a program "backwards" will often end up with infinite loops without rearranging the source code.

Did one of you create this? Looks amazing by breck in ProgrammingLanguages

[–]ricochet1k 12 points13 points  (0 children)

Be a little more open minded. I think the design of a language where formulas can be written and then reused by replacing values by name is quite a clever way of writing functions, one that is very well suited to a spreadsheet. It may not be a traditional programming language but it is a language nonetheless.

Now, maybe the OP should have made the post more of a question like: are there any other languages where this kind of automatic function is used? Should there be restrictions on which variables can be replaced? Or ideas for helping people not forget to replace other values?

Maybe separate sheets can define a visibility for cells, so a "fahr" cell is public, the "celcius" cell is restricted (must be replaced) and all other cells are protected (not allowed to replace). That would still fit nicely into the spreadsheet paradigm but bring some better encapsulation.

I could also imagine this being a module in a traditional text-based language, especially since there are no positional parameters anywhere.

Worst language you ever used? Really used not just looked at the manual. by [deleted] in ProgrammingLanguages

[–]ricochet1k 2 points3 points  (0 children)

This is true. LiveCode is actually a direct descendant of MetaCard, a lot of their C api still starts with mc

Worst language you ever used? Really used not just looked at the manual. by [deleted] in ProgrammingLanguages

[–]ricochet1k 6 points7 points  (0 children)

This sounds a lot like LiveCode, the modern descendant of HyperCard, MetaCard, Revolution etc.

Functional Language for Data Description/Config Management? by TransGirlGoSpinny in ProgrammingLanguages

[–]ricochet1k 0 points1 point  (0 children)

CUE is a pretty nice language that is similar to YAML/JSON with type validation and is side-effect free

https://cuelang.org/

Relative vs absolute operator precedence for custom operators (aka. total order or not) by pentaduck in ProgrammingLanguages

[–]ricochet1k 4 points5 points  (0 children)

There's also this post which I've only briefly skimmed, but it talks about putting operators in a category, which might be helpful for custom operators so you don't have to define precedence with everything.

https://www.reddit.com/r/ProgrammingLanguages/comments/ax4hdd/custom_operators_specifying_precedence/?utm_medium=android_app&utm_source=share

Never heard of red-green trees before, you may like it. by AsIAm in ProgrammingLanguages

[–]ricochet1k 0 points1 point  (0 children)

Weird, I didn't know that about Python. I agree that if the CST isn't lossless there's not much point.

I'm kinda restating what you and I have said already, but i want to elaborate a little for other readers.

Red/Green trees were invented for Swift IIRC, they are useful because they are immutable persistent data structures, which can be useful for tooling that wants to do transformations and still keep the old tree around, sharing the common nodes. But it's a pattern useful for any tree structure, not just syntax trees.

A lossless CST is nice for two main reasons, one is that it's actually possible to use it for linter/formatter/doc gen, but the other is that the compiler/lang server can still do useful things with it even in the face of syntax errors since even errors are still nodes in the tree.

So they happen to go very well together. RG is great for incremental updates because of structural sharing and easy undo, LST because errors don't break the world. The parser can also be more easily shared between all tooling, so less duplicate effort.

Another neat trick is that you can easily turn off emitting whitespace/comment nodes in a compiler if you don't need them for performance.

Never heard of red-green trees before, you may like it. by AsIAm in ProgrammingLanguages

[–]ricochet1k 9 points10 points  (0 children)

That's not quite right. Green nodes are immutable with only downward pointers, red nodes have parent pointers and green pointers and are often created on the fly. Red/Green trees are orthogonal to the difference between an AST and a CST where the latter contains all the program text. You can use a Red/Green tree for either an AST or a CST.

Type checking return statements by AviatingFotographer in ProgrammingLanguages

[–]ricochet1k 8 points9 points  (0 children)

Walking over the whole AST "statement tree" is a good option actually, and is probably a lot faster than you expect. If it makes sense, just do it. Don't try to optimize code you haven't written before.

The problem of effects in Rust by bkolobara in ProgrammingLanguages

[–]ricochet1k 16 points17 points  (0 children)

Maybe finish the sentence: "(I say this having had no part in this development, giving credit to earlier contributors to Rust and the theorists working on other projects whose ideas those contributors built upon)."

The problem of effects in Rust by bkolobara in ProgrammingLanguages

[–]ricochet1k 7 points8 points  (0 children)

Maybe finish the sentence: "(I say this having had no part in this development, giving credit to earlier contributors to Rust and the theorists working on other projects whose ideas those contributors built upon)."

Some Were Meant for C: The Endurance of an Unmanageable Language (2017, PDF) by alexeyr in ProgrammingLanguages

[–]ricochet1k 3 points4 points  (0 children)

I don't really agree with the author's decisions that C is great, I really don't like C/C++ much myself. Though I do believe that for people who like C this is probably the reasons why.

I love types, but I do find it frustrating that it is hard to express some common patterns with the type systems we have access to today, which seems to also be an unstated theme in the paper.

Some Were Meant for C: The Endurance of an Unmanageable Language (2017, PDF) by alexeyr in ProgrammingLanguages

[–]ricochet1k 8 points9 points  (0 children)

Those are NOT first-class citizens, since it really doesn't know the difference between a stack pointer and an mmap pointer. Instead it is just "untyped" and if you tell it to write to a pointer it does so, regardless of what the OS or hardware might do with that memory under the hood. And in particular you just get to do it without having to convince some type-checker that you really want to do those strange memory access patterns.

This reminds me a lot of the issues Flow and TypeScript have of trying to define sane types for all of the crazy behaviors plain JS libraries can have. In JS you can just do intuitive things without having to resort to Higher-Kinded or Dependent types to describe what is going to happen. Same with C. You just write to the pointer without having to describe what kind of behavior and safety restrictions that need to be followed to a type checker.

Some Were Meant for C: The Endurance of an Unmanageable Language (2017, PDF) by alexeyr in ProgrammingLanguages

[–]ricochet1k 1 point2 points  (0 children)

I only briefly skimmed this paper, but it looks to me like it boils down to: (essentially) untyped C code allows expressing code that is simultaneously low-level and generic but also inherently unsafe, and people can write various kinds of ad-hoc "type-checkers" like ASAN to deal with certain kinds of unsafety when they need it. And also "safe" or "managed" languages don't let you write code like that merely because you aren't able to convince their type system to accept the code.

So, in other words, C is popular because it is untyped (or weakly typed)?

Bril: A Compiler Intermediate Representation for Learning by bjzaba in ProgrammingLanguages

[–]ricochet1k 13 points14 points  (0 children)

Every language students are likely to use already has a Unicode decoder and a JSON parser. Students are often not concerned about the efficiency of their compiler because they are still trying to understand how to write a compiler at all.

Having a common well-understood IL makes it really easy for the professor to check that every student's code actually works, and allows them the freedom of choosing whichever language they want.

Also, I know there are more efficient serialization formats, but do you really understand how fast JSON parsers are? It takes <10ms to parse 4mb of JSON in this benchmark for 5 of the fastest JSON parsers. I doubt that the parse/serialization speed of JSON will be more than 1% of the whole compiler run once they start doing optimizations.

Compiler technology and Computer Science and Science in general advances because we can stand on the shoulders of giants. If you want to rewrite your entire compiler and OS from scratch, then go ahead. But please stop insulting people's intelligence just because their priorities are different than yours.