Live data from Hacker News

Giving Ada a Chance

ajxs.me

201–210 of 261 posts

Re: Giving Ada a Chance

#201
post #188

Earlier quoted context omitted.

So your first example was clearly a bad example. This was a better example. But even so, this is a lousy example since x is already defined at the top. So the for loop could theoretically use the defined x already. I think what you're looking for is something akin to the following in C: int x = 5; for (int x=0; x But I would argue that this is terrible C code since the inner x shadows the outer scope leading to confu…

No, the first example illustrates the fundamental problem that all iterations of the loop share the same scope rather than a new one each. In your example, the variable `x` is also shared with all iterations of the loop. Rather, it is more so as so in C , like syntax what is the common approach: while(1) { int x = next(iterator) if(STOPITER) { break } /* code that uses x */ } Every iteration of the loop receives a br…

I would argue that code that is sensitive to scope is bad code no matter which language it's written in, since now you're constantly asking "When does a variable leave scope." If I change the scope of a variable, it causes a subtle change that breaks the closure.

In that case I would prefer to be explicit that the closure "wraps" a new instance of the variable rather than relying upon implicit language behavior to guarantee the scope is correct.

As python says in "import this": "Explicit is better than implicit."

Re: Giving Ada a Chance

#202

Earlier quoted context omitted.

It's lack of a normal, standard scoping model alone teaches a very flawed reasoning about computer programs. Scoping in class definitions is weird, yes. But is that your complaint? What's wrong with the scoping model in general?

It's not merely that. That for-loops work by assignment rather than creating a new scope, or that if-conditions do not create a new scope for their arms is most unusual. Not only does it not teach programmers to properly reason about scope, but it results into subtle bugs that are easy to miss. Consider the following: list = [] for x in iterator: list.append(lambda y: some_code_that_closes_over(x)) This almost certai…

All you need is "x=x" to make a copy:

  list = []
  for x in iterator:
    list.append(lambda y, x=x: some_code_that_closes_over(x))
That way the closure is explicit and much clearer when you look at it later.

("list" is a builtin, so not a good variable name.)

Re: Giving Ada a Chance

#203
post #198

Earlier quoted context omitted.

I really don't think you should use C as a teaching language. There are way too many pitfalls, and using libraries is quite cumbersome.

I wouldn't program production code in C if I could avoid it. But sometimes you can't avoid it, and I wouldn't program production code in Pascal, either.

A programming language can both be the best fit for a concrete production problem and very unsuited as a teaching language.

Re: Giving Ada a Chance

#204
post #163

Earlier quoted context omitted.

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.

The problem is employers require computer science degrees, especially for entry level jobs. Then there's things like coding tests about inverting binary tries and such that tends to be less thoroughly covered in trade schools. When employers have more realistic demands we might see some change. At the same time colleges are morphing into expensive trade schools, their advertising is full of phrases like "preparing yo…

In Portugal it used to be relatively easy, do you want a degree with focus on the job market?

Polytechnic, with 3 years duration.

Do you want to learn to learn, and be prepared for any kind of challenge, with a professional title?

University, with 5 years duration

Now with Bologna, the rules changed a bit, however the universities sell the fact that now with 5 years the degree includes the master title, which used to require up to 3 years more on top of the 5.

As far as I am aware, other European countries have similar approaches, and in most of them in what concerns state universities, the biggest expenses are lodging, food and getting the required teaching materials.

Re: Giving Ada a Chance

#205

No discussion of Ada is complete without referencing the cost of commercial development licenses. They're expensive. Very expensive. Any enthusiasm for this language is inevitably quashed upon encountering the $$,$$$ per-seat price of the compilers for the absolute bare-bones x86 version. It's more if you want to target non x86. I pester AdaCore for info every few years and while they've dropped a little bit, they're…

Except that it the GNAT compiler is part of GCC and GPL with the linking exception. Why not use that?

And I don’t get what you mean with “pestering for info”. I’ve once discussed buying their compiler and I was by no means in a F500 (decided against buying btw).

Re: Giving Ada a Chance

#206
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…

A lot of Universities and company's were bribed by Sun to start using Java.

Our university started to use Java right way in 1996 for compiler design and distributed systems.

Sun didn't need to bride our teachers, doing the same in C and C++ was such a pain with 1996 compilers and POSIX, that they didn't thought twice about changing into an interpreted language.

Re: Giving Ada a Chance

#207

I love Ada, unfortunately it’s real world use seems to be relegated to old legacy code. I’d like to use it a little more on the side, but I also need to keep my priorities focused on realism, which sadly means ignoring Ada and learning something like C++ which seems unapproachable from any angle. Ada also seems to have a weirdly negative rep in many circles it seems. I recall looking around for an Ada compiler for a…

NVidia is writing new greenfield code with Ada/SPARK.

Re: Giving Ada a Chance

#208
post #145

Earlier quoted context omitted.

Wirthian languages seemed to keep the 6bit symbol encoding of the original Pascal, where the symbols and keywords ended up case-nonpreserving. Was that changed at any point with Modula or Oberon? I never have seen any code with all caps.

Oberon is case-sensitive and all keywords are all caps. I was curious to see it because I like Object Pascal/Delphi, that was the most distracting part of the language coming from Delphi standards.

That approach used to be chosen by many languages, because it is the best alternative to syntax highlighting when none is available.

Re: Giving Ada a Chance

#209

No discussion of Ada is complete without referencing the cost of commercial development licenses. They're expensive. Very expensive. Any enthusiasm for this language is inevitably quashed upon encountering the $$,$$$ per-seat price of the compilers for the absolute bare-bones x86 version. It's more if you want to target non x86. I pester AdaCore for info every few years and while they've dropped a little bit, they're…

Except that it the GNAT compiler is part of GCC and GPL with the linking exception. Why not use that? And I don’t get what you mean with “pestering for info”. I’ve once discussed buying their compiler and I was by no means in a F500 (decided against buying btw).

I've poked at it once, but it's a toy without the tooling and documentation the commercial vendors provide. GPLv3 is also a non-starter.

Re: Giving Ada a Chance

#210
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…

what school did you go to? My university (Radford) did teach Ada as well the first year, way back in 1999, and switched to Java after it. I liked Ada a lot, but Java gave me employment after school.

Western Washington University. I think they dropped Ada from the first courses in 2012 or 2013. Would be curious to see how those courses heavily featuring Racket have changed in the last decade while Racket was rapidly improving.
Post reply on HN