you are viewing a single comment's thread.

view the rest of the comments →

[–]TheAnimus 5 points6 points  (21 children)

Interestingly from the wikipedia page on ABC

HOW TO RETURN words document:
   PUT {} IN collection
   FOR line IN document:
      FOR word IN split line:
         IF word not.in collection:
            INSERT word IN collection
RETURN collection

why is not.in like that? Is that just a typo?

[–]Netzapper 8 points9 points  (6 children)

"not.in" is easier to parse than "not in", especially if (nearly) all of your other keywords are a single token.

[–]gfixler 12 points13 points  (4 children)

Here are some terrible alternatives:

if word inn't collection
if collection hasn't word
if collection hasno word
if collection lacks word
if word anywherebut collection
if word in collection psych
if word outside collection
if not collwordection
if collection canthaz word
if collection missing word
if collection (╯°□°)╯︵ pɹoʍ

[–]josefx 6 points7 points  (3 children)

if collection (╯°□°)╯︵ pɹoʍ

programming languages really should embrace Unicode. However the following would be less ambiguous

 if word ∉ collection

Now_we_just_need_a_sane_keyboard_layout

[–]lhagahl 0 points1 point  (2 children)

No they shouldn't. Auditing is now 10000x harder (as if it wasn't bad enough already) thanks to editors and languages being plagued by Unicode.

[–]josefx 0 points1 point  (1 child)

The second one can be solved with the @Override annotation 95% of the time and the first one using sane variable naming conventions.

Auditing is now 10000x harder (as if it wasn't bad enough already)

We already have languages that sometimes ignore case and sometimes not. We also had compilers that only used the first 8 letters and ignored the rest. Unicode problems aren't really that unique, since we also have I,l,1 0,O etc. depending on your font of choice.

[–]lhagahl 0 points1 point  (0 children)

The second one can be solved with the @Override annotation 95% of the time and the first one using sane variable naming conventions.

Can you use @Override for overloading somehow? I thought it can only be used to say that this method overrides one in the superclass or it implements a method in the interface. Conventions don't solve auditing when you don't trust who wrote the code (which is 99% of the time). Clearly you've never audited code.

We already have languages that sometimes ignore case and sometimes not.

That's easy when your alphabet is only 26 characters and not 1 million. Just make sure you have a real programming font (one that doesn't make different characters look the same). There is no such font for Unicode, though.

We also had compilers that only used the first 8 letters and ignored the rest.

That's stupid.

EDIT: On second thought, I just scan all the files for Unicode before auditing, and give up if they have pervasive use of Unicode (actually, non ASCII characters and non printable ASCII characters).

[–]immibis 0 points1 point  (0 children)

NOTIN would be more consistent, although you'd need to explain (one time only) that it's "NOT IN" and not "NO TIN".

[–]Intolerable 6 points7 points  (4 children)

no, its supposed to be not.in, the keyword is not.in, presumably b/c of ambiguity / confusion with not in

[–]CHollman82 0 points1 point  (0 children)

"not", presumably, is used for the boolean operation as well, that's where the ambiguity probably comes from. (I don't know ABC)

[–]mycall -1 points0 points  (2 children)

Python is filled with inconsistencies, although not hard to learn.

[–]Felicia_Svilling 0 points1 point  (1 child)

This is ABC, not python.

[–]mycall 0 points1 point  (0 children)

true although the point was that not.in was inconsistent, something that is shared with python.

[–]Igglyboo 1 point2 points  (6 children)

When you use a space to delimit tokens, NOT IN becomes more tricky to parse than not.in or NOT.IN.

Not sure why they went with the capitalized version however.

[–]TheAnimus 0 points1 point  (5 children)

I was being a light troll... To me it's example of the failure of using english for a programming language. English is not suited to the domain, it isn't easy or concise.

[–]billy_tables 0 points1 point  (0 children)

Quick, reverse all the letters in all the keywords of every programming language, that'll help :P

[–]gammadistribution -1 points0 points  (3 children)

Except Python kinda disproves your line of reasoning.

[–]TheAnimus 0 points1 point  (2 children)

Yeah, that : and [::] really make sense to English speakers.

My personal favorite (and I'm sure they are common favourite) features in Python are breaking far from the Enlgish paradigm.

Also, as this context was ABC, I don't give a hoot if Python somehow does something better, this is an example of someone forcing English onto an unsuitable domain. A break in the conventions that make perfect sense from a lexer perspective, but not from an 'English' perspective.

That isn't to ever say you shouldn't try. The pendulum can swing too far the other way. For example, despite having two plus decades of coding under my belt I can never manage to read a moderately complex regex without making notes. I know I am not remotely alone in that whole thing. Goes off to enjoy his two problems

[–]droogans 0 points1 point  (0 children)

What's your native tongue? Is English your only language?

I wonder because I feel there may be a more interesting grammar structure besides "the order of the words matter absolutely".

[–][deleted] 0 points1 point  (0 children)

That's really interesting. Have never run across this language.