Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror

Comment: Re:Advantages are gone. (Score 1) 144

by HiThere (#48900041) Attached to: Ask Slashdot: Is Pascal Underrated?

Sorry, but the length defined strings are optional, though common in Pascal. UCSD (and other early) Pascals usually buit that into the language, but I believe that now it's a part of a standard library, and alternates can be defined (though probably not with the same name). I'm not sure why you consider Pascal data structures more "well defined" than C structs.

P.S.: Strings in C can also be handled with a length byte. The zero terminated strings are purely a library convention, and can be overridden.

FWIW fpc Pascal has a string type in it's library that uses a length value longer than a byte.

Comment: Re:a great first language to learn (Score 1) 144

by HiThere (#48899997) Attached to: Ask Slashdot: Is Pascal Underrated?

FWIW, there's nothing intrinsically wrong with Pascal...or less than with C or C++. Java is worse, hobbled by 16-bit unicode, a horrible decision, which was justifiable at the time the decision was made. (Unicode should be either utf-8 or utf-32 [UCS-4]. I generally prefer utf-8, but that requires more complex library support.)

OTOH, the only real advantage of Pascal is fast compile times, and optimal execution times (which can easily be matched in C).

So, yes, its underrated, but there's probably no good reason to change to it.

Comment: Re:Discussion is outdated (Score 2) 144

by HiThere (#48899931) Attached to: Ask Slashdot: Is Pascal Underrated?

From my point of view, the problem is lack of documentation. I *think* that fpc Pascal can not properly handle utf8 strings, and determine the general character class of individual characters (something that Java struggles with), but the documentation is so bad that I'm not sure. And I didn't bother to test because I couldn't find any good samples to start from. Lazarus has a lot of good press, so i can accept that it is a powerful GUI development tool, but that's not what I'm doing.

FWIW, I've got a long series of desires for my programming language, and no language that I'm aware of satisfies all of them. But if its a lot different from languages that I already know, then I'm less willing to invest time learning. Pascal should have a clear bonus here, as I used to program in Object Pascall on the Mac II, but the documentation is so bad that I've tried radically different languages (e.g., Racket Scheme) and passed over fpc. (Mind you, a few years ago it was missing some needed features, but now I think that it has all the features I need, probably, but I can't be sure.)

Comment: Re:This guy hasn't done his research. (Score 1) 629

by HiThere (#48877901) Attached to: Justified: Visual Basic Over Python For an Intro To Programming

References are essentially the same as pointers anyway for what matters here.

I think this is why we are disagreeing. I don't consider them the same. (Reference in Python doesn't mean the same as reference in C++. Those are, indeed, essentially pointers.)

Using Python references does, indeed, enable a high level understanding, but it doesn't facilitate a low level understanding. And I consider hash tables (dicts) much more important than priority queues...which, of course, is why Python has them built-in.

Comment: Re:This guy hasn't done his research. (Score 1) 629

by HiThere (#48872173) Attached to: Justified: Visual Basic Over Python For an Intro To Programming

Well, no. Pickle doesn't solve this, as it requires the entire file to be one image. Shelve is closer, but still doesn't fit my needs. I need to stick data structs into a database, and what I settled on as the best option available is a combination of rexpr and ast.literal_eval. But that *does* mean converting everything into text to save it. (Pickle allows untrusted data arbitrary execution, whereas ast.literal_eval just reconstitutes forms that are built-in and are safe, or at least that's what the docs say.)

Comment: Re:This guy hasn't done his research. (Score 1) 629

by HiThere (#48872121) Attached to: Justified: Visual Basic Over Python For an Intro To Programming

Python doesn't implement its data structures in Python, though there is usually a Python implementation with the same interface...but which is a LOT slower. But Python doesn't have pointers. (References are close, but not really the same.) So Python isn't a good choice for implementing data structures as a teaching environment. I haven't looked into how Smalltalk implements them, but I suspect its basically the same approach. The advantage of references is that they allow garbage collection to be efficient, but the concept is sufficiently different from pointers that it prevents actual understanding at a low level.

OTOH, I'm not sure how a pointer language should handle memory allocation and release in an introductory course. (I started with assembler and FORTRAN IV, so I don't have the correct perspective.)

Comment: Re:Teach them Java or C# (Score 1) 629

by HiThere (#48857821) Attached to: Justified: Visual Basic Over Python For an Intro To Programming

Well, when I started the first thing we were taught was assembler...of course, assemblers were simpler then. I found it useful for quite awhile, but these days I never look at assembly code (though others do).

To me it seems that C is the proper language to start with for high school or later. Younger students might benefit more by learning something like Scratch. But C is a "portable assembler". (Well, almost.) It is simple enough to do simple things in, and it enables the teaching of data structures, logic, debugging, etc. BUT DON'T STOP THERE. You also should teach Java, at least a bit of Scheme or Lisp, and probably Python and Ruby. And, of course, some C++. These latter languages don't need the depth of coverage that you should give to the first language (i.e., C), but enough that you can see what their strengths are. Say a week on each, in each case translating some program that you've done earlier in C.

I've probably outlined more than a one year class, however.

Comment: Re:This guy hasn't done his research. (Score 1) 629

by HiThere (#48857649) Attached to: Justified: Visual Basic Over Python For an Intro To Programming

What is a "scripting language"?

FWIW, Python compiles text file to run on a virtual machine, so it's a compiler. I'll agree that it's not particularly efficient, but most things I work with end up being I/O bound, so Python is "fast enough".

What I don't like is that it's difficult to dump a piece of data to the disk without converting it into text first. Everything ends up depending on pointers (hidden from the user, so you don't need to worry as long as everything stays in RAM). This would make structs useless even if Python supported them. And this is the kind of inherent inefficiency that bothers me...but it's so much faster to develop in, that I'm using it now, and after I finish I'll consider what parts to convert to something else.

P.S.: For many things Python is quite efficient, because so much can be done with built-in libraries (that were hand-coded and optimized in C). I'm not claiming that it's totally efficient, but there are lots of tradeoffs.

Comment: Re:This guy hasn't done his research. (Score 1) 629

by HiThere (#48857493) Attached to: Justified: Visual Basic Over Python For an Intro To Programming

The thing is, if you're using Python you don't implement lists, you use the built-in functions. So it seriously depends on what you want to teach.

If you want to teach data structures, C is a better language, because you aren't teaching them to ignore the characteristics of the language. If you just want to teach basic sequencing, etc., something like Scratch is better. It's sort of a graphical subset of Smalltalk adapted for simple animations, or perhaps a cross between Smalltalk and Logo, but the programming is visual rather than typing. It's designed to be useful for grade school children. It's great for teaching sequencing, composition, logic, etc. It's lousy for teaching data structures.

Personally, I can't see any justification for selecting VB *or* VB.net. I.e., I can't imagine what you are trying to teach that would make VB the preferred language. And while Python is a better choice, I can't see that as an introductory language either. Were I doing it I'd probably have them use Scratch first and then switch over to C, or a C++ subset that was equivalent. This would, however, be a jarring transition. Scratch is a contained environment designed to be attractive to young children. It would be an easier transition if one started with Squeak's etoys, but it would make for a rough start, and the last time I tried it (years ago) there were several bugs that would make getting started difficult.

Comment: Re:call me skeptical (Score 1) 357

by amorsen (#48835575) Attached to: NASA, NOAA: 2014 Was the Warmest Year In the Modern Record

Of course there is. One powerful negative feedback is that CO2 lets less and less infrared radiation escape, so every new added CO2 atom in the atmosphere has less effect than the previous one -- it cannot block radiation which was already blocked by other CO2 atoms.

This is part of the reason why doubling of CO2 levels "only" causes a linear temperature rise. CO2 only has a logarithmic effect on the temperature.

Which is lucky. Anything more complex than bacteria would have trouble surviving the wild temperature swings that a linear correlation between CO2 and temperature would cause.

"Being against torture ought to be sort of a bipartisan thing." -- Karl Lehenbauer

Working...