Live data from Hacker News

Giving Ada a Chance

ajxs.me

151–160 of 261 posts

Re: Giving Ada a Chance

#151
post #39

> I can’t help but think that complicated programming paradigms would seem more intuitive to beginners if taught through Ada instead of C and its derivative languages, as is common in computer science and engineering faculties worldwide. At my university, the first courses you took in CS used Ada. I think it was a really good choice but I was in the minority I guess because after my year they switched to either using…

I help beginner python students. Python might be a nice easy scripting language for bashing out NUMPY scripts, but I'm beginning to suspect it is terrible for teaching. The "what type is this variable, and will this function automatically convert it for me" game is not very fun at all for beginners.

I feel that Python will be known in the future as the language that caused a generation to have a crippled sense of reasoning about how to design computer programs.

It's lack of a normal, standard scoping model alone teaches a very flawed reasoning about computer programs.

Re: Giving Ada a Chance

#152
post #100

Earlier quoted context omitted.

I get what you're saying, but learning C teaches you about the C memory model instead of "real machines". C was designed for portability across different architectures and, believe it or not, was considered high-level and abstract at one time. But I agree that learning C is valuable because I believe that learning about manual memory management is valuable.

>I get what you're saying, but learning C teaches you about the C memory model instead of "real machines". No. C doesn't do that, not at all; see: https://queue.acm.org/detail.cfm?id=3212479 If you want to get to the down and dirty, and quickly, without nearly all the "Gotcha!" inherit in C, FORTH is the way to go. >C was designed for portability across different architectures Absolute bullshit. This is a claim that…

How can you say C has no real value in a professional setting? Look at the amount of C code in any Linux distribution, even ignoring the kernel itself.

Re: Giving Ada a Chance

#153

I really like Ada's ranged types (VHDL has them also - it inherited them from Ada). You can say: type OperatingTemp is range 33 .. 90; And then declare variables of that type and they will be range checked - an exception will be thrown if the variable goes out of that range. Wish more languages had this feature.

If I have two OperatingTemps, can I add them? What is the type of the sum?

Yes and it would be the same type but there is a risk of overflow (and underflow with subtraction) which could result in a runtime exception (same as the risk with conventional integers). You’d want to include a guard that prevented those results.

Re: Giving Ada a Chance

#154

Earlier quoted context omitted.

I wouldn't say Ada lacks memory safety. It doesn't go for 100%-in-all-cases but neither does Rust. The main differences are that it doesn't do memory safety by default (which is significant), and also treats memory safety with less granularity. Aside from simply making manual memory management less frequent (with things like variably sized arrays), it has memory pools and subpools to handle more large-scale memory sa…

I think it’s time we start expecting 100% memory safety as table stakes, because any flaws are catastrophic. Moore’s Law has more than paid for it; Android could run an animated display and a Bluetooth stack in a wristwatch seven years ago.

One area where I think Ada has the edge is providing language constructs that make bare metal programming safer. Concepts like 'dangling pointers' and 'memory leaks' aren't relevant in a programming environment without a heap. In bare-metal programming on a microcontroller you're more likely working within a flat memory model where the 'memory safety' provided by some modern programming languages is less relevant. Arguably, this is the context within which safety-critical programming is actually happening.

Re: Giving Ada a Chance

#155
post #39

> I can’t help but think that complicated programming paradigms would seem more intuitive to beginners if taught through Ada instead of C and its derivative languages, as is common in computer science and engineering faculties worldwide. At my university, the first courses you took in CS used Ada. I think it was a really good choice but I was in the minority I guess because after my year they switched to either using…

I think there's a pedagogic void here. Everybody enjoys quick returns. be it a lisp repl, php f5 refresh or bash .. the desire to have clear mental model of your program state comes after (unless you have both brain power, talent and/or passion for that)

Re: Giving Ada a Chance

#156
post #34

In answer to what appears to be a misunderstanding about Rust: > Its foreign function interface seems particularly poorly implemented. The official Rust documentation suggests the use of the external third-party libc library (called a 'crate' in Rust parlance) to provide the type definitions necessary to interface with C programs. As of the time of writing, this crate has had 95 releases. Contrast this with Ada’s Int…

Regarding `repr(packed)`: Thank you for posting this. I really like Rust's official documentation on the subject. I stand corrected regarding Rust's support of structure packing. The following statement is a little troubling however: "As of Rust 2018, this still can cause undefined behavior." This greatly affects Rust's suitability for bare-metal programming, where you very often require control over a structure's layout in memory at bit-level granularity.

Regarding bitfields: At the risk of sounding a little old-fashioned, I don't like the idea of having to import external packages to provide these kinds of fundamental features. The article hints as much. It might be a bit of a culture clash however I feel that learning the different styles and interfaces of a bunch of external packages is an extra, undesirable cognitive burden imposed on the developer. Plus, "A macro to generate structures which behave like bitflags" (The crate's official description) doesn't sound very robust to me. It sounds like precisely the kind of hack that a future release could break.

In fairness, it should be mentioned that the C standard does not guarantee the layout and order of individual bitfields either (refer to section 6.7.2.1 paragraph 11 of the C1X standard). Even though the usage of bitfields is common in C, it's not without its issues.

Re: Giving Ada a Chance

#157

Earlier quoted context omitted.

I have little knowledge of HDL’s but I’m constantly hearing bad things about Verilog and good things about VHDL. Is it worth picking up?

I much prefer VHDL to Verilog. Mostly because you can define your own types in VHDL but can't in standard verilog (SystemVerilog is closer to VHDL in capability). Also because the whole reg thing in Verilog just doesn't seem very ergonomic to me - I have to stop and look things up when coding state machines or similar stateful things in Verilog. In VHDL you've got signals and variables. Signals can have state. Variab…

I’ve been told Verilog is more predominant in the US and VHDL in the EU. Any idea how that happened?

Re: Giving Ada a Chance

#158

I took my first university course in Ada in 1981. I also worked for a company that provided an Ada runtime in the mid 80's. Ada was sabotaged early on because it was 'mandated' by the DOD for new programs. That meant that all the usual suspects, like Lockheed, GD , TI (I don't remember exactly which ones) came up with Ada compilers and runtimes that cost on the order of $10K per seat. The typical military contractor…

>> That meant that all the usual suspects, like Lockheed, GD , TI (I don't remember exactly which ones) came up with Ada compilers and runtimes that cost on the order of $10K per seat.

I always wondered why I've never seen it used outside government work. Your explanation seems incredibly obvious after reading it.

Re: Giving Ada a Chance

#159

Earlier quoted context omitted.

I help beginner python students. Python might be a nice easy scripting language for bashing out NUMPY scripts, but I'm beginning to suspect it is terrible for teaching. The "what type is this variable, and will this function automatically convert it for me" game is not very fun at all for beginners.

I feel that Python will be known in the future as the language that caused a generation to have a crippled sense of reasoning about how to design computer programs. It's lack of a normal, standard scoping model alone teaches a very flawed reasoning about computer programs.

I'd vote for Javascript over Python.

Re: Giving Ada a Chance

#160
post #39

> I can’t help but think that complicated programming paradigms would seem more intuitive to beginners if taught through Ada instead of C and its derivative languages, as is common in computer science and engineering faculties worldwide. At my university, the first courses you took in CS used Ada. I think it was a really good choice but I was in the minority I guess because after my year they switched to either using…

> after my year they switched to either using Java or Python They do this because of intense negative feedback from students who don't like having to learn languages for which there is no job market.

There's something wrong with the idea that you go to college for a computer science degree just for the job market, and not the science. If getting a job is all that matters, surely a trade school or boot camp is the better route. But then I'm of the opinion that college shouldn't be in the market of mass producing future workers.
Post reply on HN