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
Deus Rex
Mar 5, 2005

sarehu posted:

Most languages let you shadow variables or at least global variables. You'd get a warning for that, but there's also function overloading, method names.

Case sensitivity just makes everything more inconvenient. Being able to write String string; is a good thing. The more modern thing to do is to not only be case sensitive, but to have mandatory case conventions followed, like capitalization for type names, to the point where capitalizing or lower-casing a word could have direct semantic consequences.

No the modern thing is to consider the identifiers foobar and f___O__o________BA_r________ identically in the eyes of the compiler.

Adbot
ADBOT LOVES YOU

Linear Zoetrope
Nov 28, 2011

A hero must cook

Deus Rex posted:

No the modern thing is to consider the identifiers foobar and f___O__o________BA_r________ identically in the eyes of the compiler.

But apparently Foobar is completely different!

code:
proc sameIdentifier(a, b: string): bool =
  a[0] == b[0] and a.replace("_", "").toLower == b.replace("_", "").toLower
I've heard good things about Nim, but that's a bit weird. Seems like it probably wouldn't come up much in practice if you use a consistent style, though.

VikingofRock
Aug 24, 2008




Deus Rex posted:

No the modern thing is to consider the identifiers foobar and f___O__o________BA_r________ identically in the eyes of the compiler.

Good god, how many times has Nim changed the rules for identifier equality? I could swear I looked this up just the other month and the rules were "completely case insensitive, single underscores are the same as no underscore (but 2+ underscores aren't), leading underscores are not treated this way but instead are semantically meaningful". Did I imagine that?

nielsm
Jun 1, 2009



Deus Rex posted:

No the modern thing is to consider the identifiers foobar and f___O__o________BA_r________ identically in the eyes of the compiler.

Are vectorIsLong and vector_is_long always identical or does that depend on locale?

Linear Zoetrope
Nov 28, 2011

A hero must cook

nielsm posted:

Are vectorIsLong and vector_is_long always identical or does that depend on locale?

This whole thing is fascinating to me, I learned a bit about it when exploring the Go standard library. I guess Unicode has multiple files that dictate the case of letters, and Go (as a compiler and language) always use the default file*. However, in the standard library itself, it provides a function that has an override for Turkish and Azeri (which is the same alphabet) casing rules. My guess is that Nim also likely defaults to those casing rules rather than depending on locale.

* This does cause a few problems, since CJK characters are always "uppercase" according to this file, and Go uses the case of the first letter to determine public/private, so 作る is always going to be public. Apparently the convention is to use "x作る" to de-export something.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Jsor posted:

* This does cause a few problems, since CJK characters are always "uppercase" according to this file, and Go uses the case of the first letter to determine public/private, so 作る is always going to be public. Apparently the convention is to use "x作る" to de-export something.

Jesus Christ.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Is there a manifesto out there explaining why taking identifiers literally is such a bad thing? Or why Go makes the first character of a variable meaningful like it's loving FORTRAN?

Those are both things I might have gotten behind a decade ago, but I was 16 and thought Python was neat because it didn't have curly braces or semicolons.

I'm too young to be this grumpy.

Linear Zoetrope
Nov 28, 2011

A hero must cook
Turns out I got it backwards, everything is considered lowercase, so it's X作る to explicitly make it public. Still dumb either way. Apparently they couldn't change it because by the time it was requested it'd break their backwards compatibility guarantee. The original ticket was closed with "status: unfortunate".

sarehu
Apr 20, 2007

(call/cc call/cc)

Deus Rex posted:

No the modern thing is to consider the identifiers foobar and f___O__o________BA_r________ identically in the eyes of the compiler.

Ideas for the Nim designers to seriously consider:

  • foo_bar matches foobazbar (for when you forget how to spell the identifier's name)
  • foo_bar is just use of an infix operator '_' meaning array indexing or function evaluation
  • foo_bar+baz_quux parses as foo_(bar+baz)_quux but foo_bar + baz_quux parses differently
  • foo_bar means foo * 100kPa

Space Kablooey
May 6, 2009


I really thought more people used editors with autocomplete.

loinburger
Jul 10, 2004
Sweet Sauce Jones
I use Eclipse because I'm too stubborn to switch to IntelliJ, and occasionally its autocomplete will get stuck: I'll be happily going along typing a dot followed by the first letter or two of what I want followed by a tab followed by a dot etc, and then Eclipse will suddenly say "aha this is precisely what you wanted" even though I had a couple of dot-baz's to go and it will terminate the chain with a space or semicolon or whatever, and then backspace + attempting to resume the chain results in Eclipse saying "oh okay since you've already got what you wanted then here's this entirely new thing."

bar.f + tab -> bar.foo
bar.foo.b + tab -> bar.foo.blargh
bar.foo.blargh.w + tab -> bar.foo.blargh.widget [space]

Oh no Eclipse, I actually wanted to keep going, surely a backspace + dot will resume where we left off

bar.foo.blargh.widget.f + tab -> bar.foo.blargh.widget.FullClassNameThatYouDoNotWantWhereTheHellDidEclipseEvenFindThisItHasNothingToDoWithWidgets [where I wanted "fiesta"]

Also it has problems finding static inner classes etc for right-click-add-import, so I've got to add them manually, and this is also an autocomplete crapfest

import com.c + tab -> com.companyname.*;
No gently caress you, backspace backspace,
import com.companyname.a + tab -> import com.companyname.async.*;
So it's faster to just type out the entire import and hope that I get it right rather than wrestle with an autocomplete that wants to prematurely terminate the import at every step

Maybe there's a way to fix this poo poo, but I'm stubborn (or stupid, as you prefer)

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner
Do i18n fuckups belong in this thread

qntm
Jun 17, 2009
Isn't Nim the language where the amount of whitespace modifies operator precedence, so a + b<<1 gives a different result from a+b << 1?

qntm fucked around with this message at 17:52 on Aug 14, 2015

sarehu
Apr 20, 2007

(call/cc call/cc)

qntm posted:

Isn't Nim the language where the amount of whitespace modifies operator precedence, so a + b<<1 gives a different result from a+b << 1?

Yes, but that's an experimental feature, not enabled by default.

Warnings, where precedence would have been overridden by whitespace, would make sense.

sarehu fucked around with this message at 18:12 on Aug 14, 2015

Soricidus
Oct 21, 2010
freedom-hating statist shill

Jsor posted:

Turns out I got it backwards, everything is considered lowercase, so it's X作る to explicitly make it public. Still dumb either way. Apparently they couldn't change it because by the time it was requested it'd break their backwards compatibility guarantee. The original ticket was closed with "status: unfortunate".

solution: just don't write your public api in kanji. there's nothing difficult about calling it "Tsukuru" if you're too convinced of the superiority of glorious nippon to just use english.

VikingofRock
Aug 24, 2008




What if you are a Japanese company, writing an API aimed at Japanese programmers?

Linear Zoetrope
Nov 28, 2011

A hero must cook
It's honestly more of a thing that if you know it you win that night's round of "Go pub trivia". AFAIK, most CJK programmers write their code in English (or at least ASCII), and while a Chinese programmer raised the issue, most of the programmers that speak those languages natively commented that it doesn't come up often in practice. The only thing that I think might make it more of an issue is that last I checked Go advertises itself as allowing identifiers in arbitrary unicode, and given an explicit example of using 日本語 (I believe as a variable), but again, it's basically a trivia question. Only slightly more consequential than the "register" keyword in C.

Linear Zoetrope fucked around with this message at 23:54 on Aug 14, 2015

Soricidus
Oct 21, 2010
freedom-hating statist shill

VikingofRock posted:

What if you are a Japanese company, writing an API aimed at Japanese programmers?

Every Japanese API for Japanese programmers I have ever seen has used English, except when dealing with specifically Japanese concepts, in which case it used romaji because romaji is fine and easy to work with.

Unicode identifiers aren't common, and while they may become more common with time, nobody is going to have noticeable problems today as a result of a language having imperfect support for them.

If you feel strongly otherwise, why not try to get Arabic identifiers working? Enjoy wrestling with the Unicode bidi algorithm and a bunch of characters that look identical in some contexts but not others and don't have any sort of case folding or canonical equivalence!

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I program in ancient greek and only use text editors which support proper boustrophedon text.

Impotence
Nov 8, 2010
Lipstick Apathy
i program in emojis

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



Biowarfare posted:

i program in emojis

Poop emoji is the new main function.

Since our programs are going to be poo poo anyways.

💩

piratepilates fucked around with this message at 04:07 on Aug 15, 2015

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
nowadays i only program in linear c

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
oh wait, i guess they call it objective c, but either way it's indecipherable nonsense

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.

qntm posted:

Isn't Nim the language where the amount of whitespace modifies operator precedence, so a + b<<1 gives a different result from a+b << 1?

This strikes me as potentially a really good idea provided it's properly documented and the language syntax is otherwise sufficiently unique that it doesn't cause confusion. a+b / c+d^2 strikes me as perfectly clear provided you know the space rule and considerably more readable than (a + b) / (c + d ^ 2) or however my IDE likes to format it.

Pentecoastal Elites
Feb 27, 2007

DaTroof posted:

nowadays i only program in linear c

DaTroof posted:

oh wait, i guess they call it objective c, but either way it's indecipherable nonsense

:golfclap:

crazysim
May 23, 2004
I AM SOOOOO GAY

Plorkyeran posted:

I program in ancient greek and only use text editors which support proper boustrophedon text.

You jest but the professor of a language design course I took had us create an interpreter written in Scala with greek symbols for method names, objects, and whatnot to match the notation.

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
APL got brought up a few pages ago. Apparently it's a convention to use greek letters as variables. I'd like to think that somewhere right now, a programming intern is hearing "No no, that's not a 'w' that an omega."

comedyblissoption
Mar 15, 2006
Probation
Can't post for 4 hours!

KernelSlanders posted:

This strikes me as potentially a really good idea provided it's properly documented and the language syntax is otherwise sufficiently unique that it doesn't cause confusion. a+b / c+d^2 strikes me as perfectly clear provided you know the space rule and considerably more readable than (a + b) / (c + d ^ 2) or however my IDE likes to format it.
This is a bad idea, because it invites new and wonderful opportunities for programmer error. In order to read code, you will now have to very carefully look for white space or its lack in between operators and their arguments.

comedyblissoption
Mar 15, 2006
Probation
Can't post for 4 hours!
It will also raise questions on what does it mean when there's just a single space

code:
1 *2+ 3
1* 2 +3
Unless you enforce this to be a compiler error, whichever option you choose is horrible because you've now made all your code difficult to read since a single space or its omission changes the entire meaning of the expression.

You'll also have to consider what does it mean when you break an expression across a newline.

comedyblissoption fucked around with this message at 11:08 on Aug 15, 2015

Soricidus
Oct 21, 2010
freedom-hating statist shill

KernelSlanders posted:

This strikes me as potentially a really good idea provided it's properly documented and the language syntax is otherwise sufficiently unique that it doesn't cause confusion. a+b / c+d^2 strikes me as perfectly clear provided you know the space rule and considerably more readable than (a + b) / (c + d ^ 2) or however my IDE likes to format it.

This would be great if combined with full Unicode support, so I can use zero-width spaces to alter precedence without making lines wastefully long.

qntm
Jun 17, 2009

comedyblissoption posted:

It will also raise questions on what does it mean when there's just a single space

code:
1 *2+ 3
1* 2 +3
Unless you enforce this to be a compiler error, whichever option you choose is horrible because you've now made all your code difficult to read since a single space or its omission changes the entire meaning of the expression.

You'll also have to consider what does it mean when you break an expression across a newline.

I think both of those are indeed syntax errors in the case I mentioned.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

comedyblissoption posted:

It will also raise questions on what does it mean when there's just a single space

code:
1 *2+ 3
1* 2 +3
Unless you enforce this to be a compiler error, whichever option you choose is horrible because you've now made all your code difficult to read since a single space or its omission changes the entire meaning of the expression.

tbh I would be in favour of those being syntax errors in whatever language, even if not syntactically ambiguous, because they are offensive to my eyes.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Pavlov posted:

APL got brought up a few pages ago. Apparently it's a convention to use greek letters as variables. I'd like to think that somewhere right now, a programming intern is hearing "No no, that's not a 'w' that an omega."

APL, not even once.

(preempting pedants: yes, that's actually K, an APL derivative)

(that's a text editor if you were wondering)

NihilCredo fucked around with this message at 16:13 on Aug 15, 2015

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
messages not to show to users, pt. 2

comedyblissoption
Mar 15, 2006
Probation
Can't post for 4 hours!

NihilCredo posted:

APL, not even once.

(preempting pedants: yes, that's actually K, an APL derivative)

(that's a text editor if you were wondering)
is it a requirement to only use terse 1-2 character identifiers in APL or is it just an insufferable programming style

loinburger
Jul 10, 2004
Sweet Sauce Jones
It's supposed to look mathy! When have you seen a math book with exercises like "derivative(hamburgers, time) = 5 * hamburgers - 3" or whatever???

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.
There are more than 18,000 classses in the Facebook iOS app

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

That's not even including the C++ poo poo :razz:

Nuclide exists for a reason, mostly.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

But.... why? Why the gently caress?

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Bruegels Fuckbooks posted:

But.... why? Why the gently caress?

You wouldn't believe me if I told you.

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