Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
duck monster
Dec 15, 2004

I did it! I found the worst thing!

https://github.com/ajlopez/CobolScript/blob/master/samples/mysqlweb/database.cobp

Its HTML, with embedded COBOL. Running on Node.

:suicide:

Adbot
ADBOT LOVES YOU

nielsm
Jun 1, 2009



duck monster posted:

I did it! I found the worst thing!

https://github.com/ajlopez/CobolScript/blob/master/samples/mysqlweb/database.cobp

Its HTML, with embedded COBOL. Running on Node.

:suicide:

All the bad parts of PHP, COBOL, and Node.js, in one neat package!

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



duck monster posted:

I did it! I found the worst thing!

https://github.com/ajlopez/CobolScript/blob/master/samples/mysqlweb/database.cobp

Its HTML, with embedded COBOL. Running on Node.

:suicide:

...connecting to and dumping a MySQL database.

It's actually pretty readable. A little syntax highlighting and it'd look a lot like VB. Maybe COBOL isn't so bad when you don't have old-school limits on variable names and line length.

Pavlov
Oct 21, 2012

I've long been fascinated with how the alt-right develops elaborate and obscure dog whistles to try to communicate their meaning without having to say it out loud
Stepan Andreyevich Bandera being the most prominent example of that

Munkeymon posted:

...connecting to and dumping a MySQL database.

It's actually pretty readable. A little syntax highlighting and it'd look a lot like VB. Maybe COBOL isn't so bad when you don't have old-school limits on variable names and line length.

Congratulations, you may have what it takes to maintain software for the US banking system in perpetuity!

Amberskin
Dec 22, 2013

We come in peace! Legit!

Pavlov posted:

Congratulations, you may have what it takes to maintain software for the US banking system in perpetuity!

US or elsewhere.

And you are assuming the code style is more modern than COBOL-74.

Yuck!

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner
COBOL isn't really a horrible language when you get down to it. The real pain is the thing it's pretty much exclusively used for - 40 years' worth of the most tangled, tedious cruft most developers will ever see.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Amberskin posted:

US or elsewhere.

And you are assuming the code style is more modern than COBOL-74.

Yuck!

Now that I think about it, what I said can be restated as "COBOL isn't so bad when you make it less terrible" :v:

Amberskin
Dec 22, 2013

We come in peace! Legit!

daft punk railroad posted:

COBOL isn't really a horrible language when you get down to it. The real pain is the thing it's pretty much exclusively used for - 40 years' worth of the most tangled, tedious cruft most developers will ever see.

From COBOL-85 onwards it is a pretty standard imperative language. You CAN write decent and readable code in COBOL as well as you can do it in FORTRAN or PL/I. If your problem consists on processing flat, fixed field files you won't find anything better for the job (except, perhaps, PL/I, which is the jack of all trades).

Previously to COBOL-85. it is horrible (there is an intermediate COBOL-81 which is so-so). You MUST use GOTOs to implement logic, there is no concept of nested programs (and all the storage used is static), and you can enjoy things as evil as ALTER xxxx TO PROCEED TO yyyy (and yes, this makes what it seems to make: modifies a "label" so any GOTO addressed to that label goes to another one instead).

The main problem is the old-school COBOL programmers kept writing COBOL-74 codes even under the more modern compilers. And kept the traditional formatting with the dreaded A, B and C areas invented when everyone was using punched cards. Post COBOL-81, the source is more or less free format (the only constraint is you have to indent the actual code four spaces to the right to difference it from the labels).

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Every time I see a discussion describing semantic indentation as a "more modern" style of syntax than using words or symbols as delimiters I giggle a little bit. More people should try FORTRAN and COBOL if only to gain a better perspective on the history of programming languages.

Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

Internet Janitor posted:

Every time I see a discussion describing semantic indentation as a "more modern" style of syntax than using words or symbols as delimiters I giggle a little bit. More people should try FORTRAN and COBOL if only to gain a better perspective on the history of programming languages.

Tell me your thoughts about Python.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Python is a depressingly mediocre language. There are slower languages, more dangerous languages and worse-designed languages, but it is a master of nothing.

Wouldn't bother me as much if it weren't for so many people trying to push it as a language for education. From syntax to semantics it is riddled with inconsistencies and "convenient" special cases. There are considerably smaller, simpler and more internally consistent languages (Pascal or Logo, for example) which are much easier to learn.

fishmech
Jul 16, 2006

by VideoGames
Salad Prong

Munkeymon posted:

Now that I think about it, what I said can be restated as "COBOL isn't so bad when you make it less terrible" :v:

It's more that if you took any language, and wrote a program in it 40 years ago with the other limitations of the day, you would have a miserable time dealing with it right now. And if you re-implemented that same 40 year old program with modern limits it'd probably be a lot clearer.


At some point in the not too distant future, there's going to be people dealing with a 40 year old PHP program. :yikes:

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

fishmech posted:

It's more that if you took any language, and wrote a program in it 40 years ago with the other limitations of the day, you would have a miserable time dealing with it right now. And if you re-implemented that same 40 year old program with modern limits it'd probably be a lot clearer.

...and it wouldn't work.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Internet Janitor posted:

Python is a depressingly mediocre language. There are slower languages, more dangerous languages and worse-designed languages, but it is a master of nothing.

Wouldn't bother me as much if it weren't for so many people trying to push it as a language for education. From syntax to semantics it is riddled with inconsistencies and "convenient" special cases. There are considerably smaller, simpler and more internally consistent languages (Pascal or Logo, for example) which are much easier to learn.

python has two major advantages:

- people who like perl can usually be persuaded to adopt python
- people who like matlab can usually be persuaded to adopt numpy

it's not a good language exactly, but it's managing to displace some far worse things, and that is holy work

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Soricidus posted:

python has two major advantages:

- people who like perl can usually be persuaded to adopt python
- people who like matlab can usually be persuaded to adopt numpy

it's not a good language exactly, but it's managing to displace some far worse things, and that is holy work

As someone who had to transition from Python to Java, I will also add to that list a refreshing minimum of boilerplate. Don't underestimate how important minimization of boilerplate is for an educational language, either: you want your lesson code to be as minimal as possible while still being functional. "int main(int argc, char** argv)" is pretty drat inscrutable for a newbie. And whoever thought Java was a good introductory programming language was out of their loving mind.

Volte
Oct 4, 2004

woosh woosh

Internet Janitor posted:

Python is a depressingly mediocre language. There are slower languages, more dangerous languages and worse-designed languages, but it is a master of nothing.

Wouldn't bother me as much if it weren't for so many people trying to push it as a language for education. From syntax to semantics it is riddled with inconsistencies and "convenient" special cases. There are considerably smaller, simpler and more internally consistent languages (Pascal or Logo, for example) which are much easier to learn.
Seems like a great place to start then. Learning to deal with mediocrity and special cases early on seems better than the usual method of teaching in a perfect vacuum and then throwing students to the sharks eventually when real-world problems start making an appearance. In my first year of university we were forced to use this piece of poo poo, which abstracts away basically everything about Java programming and turns it into a toy. Eventually we did have to use Python in like 3rd year, but anyone who didn't already know it had to learn it completely on their own because there was no instruction provided in class. I hear they use Python in first year now and I'm glad for it.

raminasi
Jan 25, 2005

a last drink with no ice

Soricidus posted:

python has two major advantages:

- people who like perl can usually be persuaded to adopt python
- people who like matlab can usually be persuaded to adopt numpy

it's not a good language exactly, but it's managing to displace some far worse things, and that is holy work

Yep. I don't know whether Python is "good," and I don't personally enjoy using it at all, but it seems to be an incredible productivity multiplier for researchers who are more interested in their research than the programming their research requires.

xzzy
Mar 5, 2009

I just wish those researchers would stop developing and testing Python at small scale, and when they deploy it to a cluster of 200+ workers and start hitting file descriptor limits they stop acting mystified that such a thing could ever happen.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

All the best stories start with "let's put Lua in production, where it will process millions of requests per day".

Hughlander
May 11, 2005

Subjunctive posted:

All the best stories start with "let's put Lua in production, where it will process millions of requests per day".

Bah you misspelled billions there...

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Hughlander posted:

Bah you misspelled billions there...

The service I had the conversation about is low-8-digits, so maybe there's still time.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Cloudflare claims 10 digits, but I guess they probably don't use lua for everything.

pseudorandom name
May 6, 2007

PowerDNS has a Lua backend, I wonder how many QPS it does.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Plorkyeran posted:

Cloudflare claims 10 digits, but I guess they probably don't use lua for everything.

Do you think they run Lua in their CDN asset serving code path? They might, CDN systems usually have CPU to spare.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Volte posted:

Seems like a great place to start then. Learning to deal with mediocrity and special cases early on seems better than the usual method of teaching in a perfect vacuum and then throwing students to the sharks eventually when real-world problems start making an appearance.

I'd rather deal with junior developers who have a strong grasp of fundamentals like iteration, recursion, bread-and-butter algorithms and complexity analysis taught in a "perfect vacuum" than junior devs who only know about the ephemeral quirks of frameworks and tooling and can barely piece together a trivial loop. In practice we end up with loads of people who have a grasp of neither.

I think that learning to program and learning a language are largely orthogonal tasks which simply tend to happen at a similar time for beginners. If you learn to program, you can pick up any language in the same general paradigm with a minimum of effort. If you learn a language without fundamental skills, you're a cargo-cult programmer. Thus, learning to program is the skill which matters. Small, simple languages allow that initial focus to be heavily weighted towards fundamentals. Eventually you are going to have to learn to deal with the ugliness of the real world, but I don't see the value in hobbling and discouraging beginners.

sarehu
Apr 20, 2007

(call/cc call/cc)

Internet Janitor posted:

I'd rather deal with junior developers who have a strong grasp of fundamentals like iteration, recursion, bread-and-butter algorithms and complexity analysis taught in a "perfect vacuum" than junior devs who only know about the ephemeral quirks of frameworks and tooling and can barely piece together a trivial loop.

Nobody here is defending this dichotomy.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
What language would you recommend they learn, though? I'm not aware of any language that everyone enjoys. Out of the plangs (PHP, Perl, Python, Ruby, JavaScript) Python seems to be least worst of them.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
Python is a pretty flawed language with an ecosystem that's better than most of them. I only use it either for the slap-rashest of slap-dash stuff or to use django. I'd probably never run it again if a Haskell web framework that was not Yesod but not as loose goose as Happstack shows up... I guess it goes to me to do the work of writing one, maybe.

I honestly think that most people's first languages should either be low-level C or Haskell.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
For absolute beginners, I think Logo or Pascal could be good choices. Even a classical BASIC could be an effective tool- it could teach a few bad habits, but it has brutally simple syntax and semantics. I've worked with kids in BASIC in the past and students very quickly grasped how to trace out BASIC programs by hand and understand how they work. BASIC is pretty much working at the level of assembly language with friendlier syntax and it makes a decent gateway drug to low-level programming.

If I had to choose a mainstream plang, I would probably go with JavaScript. For all its warts, it is possible to use JS as a fairly nice functional programming language. By building on a good core, it is possible to ameliorate many shortcomings of the language through libraries. Python, on the other hand, is very deliberately designed without good building blocks for this style of programming. Anonymous functions and and Python's concept of scope and closure are very limiting.

Internet Janitor fucked around with this message at 07:59 on Jan 20, 2016

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Internet Janitor posted:

Python, on the other hand, is very deliberately designed without good building blocks for this style of programming.

quote:

filter(P, S) is almost always written clearer as [x for x in S if P(x)]

:raise:

No Safe Word
Feb 26, 2005


It makes more sense for things that aren't actual functions or when you don't want just the item from the sequence:

Python code:
[x for x in S if x > 0]

[x.foo for x in S if x is not None]
Comprehensions are just so much more powerful that even if they're a little longer they're just more intuitive to read most of the time. If comprehensions were around when the language was first released, then filter may only exist in a library instead of being a builtin function.

Doctor w-rw-rw-
Jun 24, 2008
Also, replace those [] with () and it generates it lazily.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

No Safe Word posted:

It makes more sense for things that aren't actual functions or when you don't want just the item from the sequence:

For things that aren't filters, then, you should write something other than "filter". If you want something that's not the item from the sequence, you map, optionally after filtering.

No Safe Word
Feb 26, 2005

Subjunctive posted:

For things that aren't filters, then, you should write something other than "filter". If you want something that's not the item from the sequence, you map, optionally after filtering.

Well yes or I can use the comprehension syntax which is more expressive and powerful

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

No Safe Word posted:

Well yes or I can use the comprehension syntax which is more expressive and powerful

It is both of those things, but that doesn't make it clearer. In fact, "more powerful" usually means "more opaque" when it comes to syntax.

nuvan
Mar 29, 2008

And the gentle call of the feral 3am "Everything is going so well you can't help but panic."

Subjunctive posted:

quote:

filter(P, S) is almost always written clearer as [x for x in S if P(x)]
:raise:

It's interesting to note, after you understand something, how difficult it can be to remember how... unclear things seemed when you didn't understand them. I've seen and worked with list comprehensions before, so the second form of notation made immediate sense, and I was wondering what the problem with understanding it was.

I guess it's a less extreme form of how, now that I can read, it seems to be impossible for me to look at English letters and not recognize them. I can't look at letters and see strange and meaningless markings, like I do if I look at Chinese, Japanese, Arabic, Hindi, etc... characters.

sarehu
Apr 20, 2007

(call/cc call/cc)
Seems like a good point in spacetime to post this:

https://github.com/robpike/filter

quote:

I wanted to see how hard it was to implement this sort of thing in Go, with as nice an API as I could manage. It wasn't hard.

Having written it a couple of years ago, I haven't had occasion to use it once. Instead, I just use "for" loops.

You shouldn't use it either.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

nuvan posted:

It's interesting to note, after you understand something, how difficult it can be to remember how... unclear things seemed when you didn't understand them. I've seen and worked with list comprehensions before, so the second form of notation made immediate sense, and I was wondering what the problem with understanding it was.

Well, I've implemented array comprehensions, and I think I have a pretty good handle on them. I still went ahead and implemented filter/map in the language in question, because I and many others felt that doing so made for clearer expression of those specific (nearly language-universal) operations. That language had grown around first-class functions and closures in a way that Python didn't, but I don't think that was the source of the difference in clarity. (Matching the expectations of others coming to the language from functional ones which had the usual filter/map/fold/foldr/any/all/each operations was part of the motivation, too.)

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

sarehu posted:

Seems like a good point in spacetime to post this:

https://github.com/robpike/filter

I'm not sure what my favourite part of that is. The wafting Go aroma of interface {}, or that he decided to name the map operation "apply".

Adbot
ADBOT LOVES YOU

vOv
Feb 8, 2014

Didn't Python's built-in HTTP library not actually verify HTTPS certificates by default for a long time, or am I thinking of something else?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply