HackerTrans
TopNewTrendsCommentsPastAskShowJobs

init1

no profile record

comments

init1
·vor 3 Monaten·discuss
I've read it and I agree private properties on classes satisfy the requirement. It does allow you to hide implementation details and I was unaware it was added; though with anything JavaScript you can usually find a way around it.

However I don't really want to talk to you. You are rude.
init1
·vor 3 Monaten·discuss
See my comment here for an example: https://news.ycombinator.com/item?id=47810686
init1
·vor 3 Monaten·discuss
> The article claims only Ada has true separation of implementation vs specification (the interface), but as far as I am able to reason, also e.g. JavaScript is perfectly able to define "private" elements (not exported by an ES6 module) while being usable in the module that declares them -- if this isn't "syntactical" (and semantical) separation like what is prescribed to Ada, what is the difference(s) the article tries to point out?

This is false. For example in Ada you can write:

    package Foo
        type Bar is private;
        procedure Initialize (Item : in out Bar); 
    private
        type Bar is record
            Baz : Integer;
            Qux : Float;
        end record;
    end Foo;
Users of the Foo package know there is an opaque type called Bar. They can declare variables of the type, they can use the defined API to operate on it but they cannot reference the implementation defined private members (Baz, Qux) without compile errors. Yes Ada does give you the power and tools to in a very blatantly unsafe and obvious way cast it as another type or as an array of bytes or whatever but if you're doing stuff like that you have already given up.

In JavaScript there are no such protections. For example if you have a module with private class Bar and you export some functions that manipulate it:

    class Bar {
        constructor() {
            this.Baz = 420;
            this.Qux = 1337.69;
        }
    }
    export function Initialize() {
        return new Bar();
    }
In client code you have no issue inspecting and using the private values of that class:

    import { Initialize } from 'module';
    let myBar = Initialize();

    myBar.Baz = 42069; // works just fine
    Object.keys(myBar).forEach(console.log); // you can iterate parameters.
    myBar.Quux = 'Corge'; // add new parameters
    delete myBar.Baz; // I hope no functions rely on this...
Using the private parts of Bar should 100% be a compilation error and even the most broken languages would have it at least be a runtime error. Lmao JS.
init1
·vor 3 Monaten·discuss
As far as I can tell you cannot create your own bounded Integer/Floating point types in any of the ML languages. That's one example of one of the core Ada type features. Most people have never experienced a type system like Ada and you will be surprised by how it helps you write higher quality software that is also more reliable.
init1
·vor 3 Monaten·discuss
In my opinion it has both complicated and terrible syntax that it inherited and extended from c++ and complicated semantics.
init1
·vor 3 Monaten·discuss
It is not that I cannot remember the symbols - I don't want to; I want the language to plainly explain itself to me. Furthermore every language has it's own set of unique symbols. For new readers to a language you first have to familiarize yourself with the new symbols. I remember my first few times reading rust... It still makes my head spin. I had to keep looking up what everything did. If the plain keyword doesn't directly tell you what it's doing at least it hints at it.

To be clear Ada specifically talks about all this in the Ada reference manual in the Introduction. It was specifically designed for readers as opposed to writers for very good reasons and it explains why. It's exactly one of the features other languages will eventually learn they need and will independently "discover" some number of years in the future.
init1
·vor 3 Monaten·discuss
Verbosity is a feature not a bug. Programming is a human activity and thus should use human language and avoid encoded forms that require decoding to understand. The use of abbreviations should be avoided as it obsfucates the meaning and purpose of code from a reader.
init1
·vor 6 Monaten·discuss
Git is an OSS project and is not owned even slightly by Microsoft.

Github the website however is.

You don't need to replace git.
init1
·vor 7 Monaten·discuss
I found a project ClippyJS: https://github.com/pi0/clippyjs

That adds clippy and all the other agents to a webpage. There is a PR on the repo that adds an example that hooks clippy up to a local ollama agent: https://github.com/pi0/clippyjs/pull/17
init1
·vor 8 Monaten·discuss
What useless drivel. If you already have property rights then you have the right to own and operate computers.

The main thrust of the law is directly self contradictory.

"Government actions that restrict the ability to privately own or make use of computational resources for lawful purposes..."

OK then just make the usage you don't like unlawful and you are allowed to violate this "protection".
init1
·vor 9 Monaten·discuss
Big agree. Overly terse and symbolic languages feel very cryptic and ugly to me as well.
init1
·vor 9 Monaten·discuss
You're in luck. Try Ada (it's great BTW)
init1
·vor 9 Monaten·discuss
You can generate bindings using a gcc -c -fdump-ada-spec <header.h>. They typically work well enough without needing additional tweaks but If it's more involved you can ask Claude to make a shell script that generates bindings for whatever C library you wanted to use and it works reasonably well.

In my opinion, don't make thick bindings for your C libraries. It just makes it harder to use them.

For example I don't really like the OpenGL thick bindings for Ada because using them is so wildly different than the C examples that I can't really figure out how to do what I want to do.
init1
·vor 9 Monaten·discuss
What exactly is a "type-related disadvantage"?

As far as I'm aware, Ada has a much more expressive type system and not by a hair. By miles. Being able to define custom bounds checked ordinals, being able to index arrays with any enumerable type. Defining custom arithmatic operators for types. adding compile and runtime typechecks to types with pre/post conditions, iteration variants, predicates, etc... Discriminant records. Record representation clauses.

I'm not sure what disadvantages exist.
init1
·vor 9 Monaten·discuss
I've never come across any range restricting constructions in C++ projects in the wild before. It truly is a shame, I think it's something more programmers should be aware of and use. Eliminating all bounds checking and passing that job to the compiler is pretty killer and eliminates whole classes of bugs.