|
All my variable names are greek letters.
|
# ? Feb 25, 2016 01:40 |
|
|
# ? May 17, 2024 17:52 |
|
I just use "i" with subtly different diacritics.
|
# ? Feb 25, 2016 01:41 |
|
I just write my code pre-minified so I don't need another compile stage.
|
# ? Feb 25, 2016 01:45 |
|
In languages which support utf8 source, save extra space by using whitespace characters, especially zero-width varieties.
|
# ? Feb 25, 2016 02:42 |
Soricidus posted:All my variable names are greek letters. I'm always a little tempted to do this when there is a well-established greek letter for something in my physics code. So far I've resisted the temptation, but it would be kind of fun to write (r, θ, φ) instead of (r, theta, phi) or (radial_distance, polar_angle, azimuthal_angle).
|
|
# ? Feb 25, 2016 03:19 |
|
VikingofRock posted:I'm always a little tempted to do this when there is a well-established greek letter for something in my physics code. So far I've resisted the temptation, but it would be kind of fun to write (r, θ, φ) instead of (r, theta, phi) or (radial_distance, polar_angle, azimuthal_angle). I seriously am using θ to represent an angle in some visualisation code. Why not?
|
# ? Feb 25, 2016 03:28 |
|
Soricidus posted:I seriously am using θ to represent an angle in some visualisation code. Why not? Because it's difficult for humans to type if they need to edit the code at some point. You might as well use a poo emoji.
|
# ? Feb 25, 2016 03:36 |
|
Just use emoji for your variable names. Use the handy popup palette to store your recently used members.
|
# ? Feb 25, 2016 03:36 |
|
I still find it easier to google a unicode/emoji then ctrl-c it to paste in whatever I'm typing.
|
# ? Feb 25, 2016 03:38 |
|
VikingofRock posted:I'm always a little tempted to do this when there is a well-established greek letter for something in my physics code. So far I've resisted the temptation, but it would be kind of fun to write (r, θ, φ) instead of (r, theta, phi) or (radial_distance, polar_angle, azimuthal_angle). I do this when writing Mathematica code.
|
# ? Feb 25, 2016 05:14 |
|
Never write image processing code. It always looks like this:C++ code:
|
# ? Feb 25, 2016 06:08 |
|
Suspicious Dish posted:Never write image processing code. It always looks like this: Eh, considering what you are doing, multiple for loops are likely unless you vectorize into a single long array.
|
# ? Feb 25, 2016 06:31 |
|
That code is mostly readable and understandable, which makes it distinctly above average as far as image-processing code goes. I guess it'd be less clear for people who don't know what operation it's performing based solely on the coefficients used?
|
# ? Feb 25, 2016 06:45 |
|
I wrote that code, and I always get strange looks when I show it to people. If you do image processing long enough it mostly just becomes natural, I think. I would change "dx" to "bx" probably these days since "dx" usually means "delta x". I'm not sure why I chose 1.16 for luma and 1.1 for chroma -- that's the only part I'm not sure about. I think it was trial and error.
|
# ? Feb 25, 2016 07:00 |
|
Sounds like you could have barrels of fun exploring Array Languages, banishing the need for those loops and most of the unrolled component-wise operations to boot.
|
# ? Feb 25, 2016 07:34 |
|
APL reminds me of someone saying "you know that weird syntax you see in math papers where everything is ambiguous and uses one-letter variable names? What if that was executable" https://twitter.com/unconed/status/678412252752519168
|
# ? Feb 25, 2016 07:40 |
|
I'm sure the person who decided to post a screenshot of their text editor instead of using a pastebin or something cares very deeply about making things readable. e: Less shitpostingly I don't understand how this person manages to speak English considering that it, just like math, makes a terrible programming language as well. vOv fucked around with this message at 08:30 on Feb 25, 2016 |
# ? Feb 25, 2016 08:20 |
|
carry on then posted:Just use emoji for your variable names. Use the handy popup palette to store your recently used members. I haven't used emojis as variable names, but I did write some unit tests like this one the other day: I ❤️ UTF-16
|
# ? Feb 25, 2016 09:19 |
|
The math world realized long ago that it has to contend with something the English-speaking programming world has convinced itself it doesn't need to deal with, and that's cooperation among people speaking different languages. The one benefit to the way math information is conveyed is that it's, to a certain extent, language-agnostic. So it's possible to translate the text of a whitepaper while retaining the same formulas. It's a pretty good separation of application and documentation. English-speaking programmers like to pretend that most computer programming languages are language-agnostic, but that's really not the case. Due to the fact that terse/meaningless variable names are frowned upon, source code is effectively tied to English(keywords, etc.) plus whatever language the comments/variable names are written in. So all the language keywords are English, variable names must be written using the English alphabet, foreign language documentation for programming languages, if it's even available, is often machine-translated, and then when a non-English-speaking person bothers to overcome these hurdles to write some code all the English-speaking programmers sit around bitching about code quality from non-English-speaking countries. So, um, maybe programmers/engineers shouldn't pretend to know what the gently caress they're talking about it when it comes to communication. Code quality, the world over, would probably be much better if English-speaking programmers would accept the fact that it's not a big deal if some dude in China wants to use hanzi for variable names if that dude in China doesn't care about working on that project with people who don't speak Chinese. English-speaking programmers certainly don't seem to have any concern about people who don't speak English being able to read their code. Everyone should watch this Rami Ismail talk: http://www.gdcvault.com/play/1022362/We-Suck-at-Inclusivity-How ErIog fucked around with this message at 09:41 on Feb 25, 2016 |
# ? Feb 25, 2016 09:28 |
|
There's also the fact that mathematics predates text editors and Google by several millennia, it evolved to be handwritten, and it isn't a programming language.
|
# ? Feb 25, 2016 10:22 |
|
Hey, have you heard about this thing called "sheet music"?
|
# ? Feb 25, 2016 10:24 |
|
leper khan posted:Because it's difficult for humans to type if they need to edit the code at some point. You might as well use a poo emoji. Unless the human in question is Greek, of course. People do still speak/type in the language!
|
# ? Feb 25, 2016 14:26 |
|
Soricidus posted:I seriously am using θ to represent an angle in some visualisation code. Why not? def Σ(x: List[Int]): Int = (0 /: x) (_ + _)
|
# ? Feb 25, 2016 14:30 |
|
The "programmers who think the hard part of math is the notation" meme annoys me. APL has its own dialect of symbols that I don't think characterizes math notation in general. Like ○ for pi and ⍟ for log. It's cute and fun but I seriously never seen any serious math paper making up arbitrary notation for relatively well known stuff just for the sake of brevity.
|
# ? Feb 25, 2016 14:54 |
|
feedmegin posted:Unless the human in question is Greek, of course. People do still speak/type in the language! And if they're doing it on their time or working on a project where Greek is the lingua Franca, then great. I would never pass code through review that used non-standard characters. Standard here meaning within the language and reasonably expected natural keybindings for everyone on the project.
|
# ? Feb 25, 2016 14:58 |
|
Doc Hawkins posted:In languages which support utf8 source, save extra space by using whitespace characters, especially zero-width varieties. Do you know of any languages where that works? All the languages I know of which support non-ASCII names (whether the source is encoded as UTF8 or something else) prohibit whitespace in those names.
|
# ? Feb 25, 2016 15:12 |
|
A contractor with over a decade of experience with C# working for a very large bank comes in and sees this code:code:
Commit log: "Fixed Exception" code:
code:
region for a single small method? check. public access to a class's internal helper method? check. attempting to 'fix' exceptions by re-implementing fundamental .NET functionality? check. Code Review gave us the opportunity to educate this developer about the availability of Decimal.TryParse()
|
# ? Feb 25, 2016 15:36 |
|
APL notation was specifically designed to try to unify the disparate notation used in mathematics for working with vectors, matrices and logic. While complaining about the overloaded behavior of some operators is valid, its syntax and semantics follow simple, consistent rules. Some of APL's notation even "stuck" and made its way into mainstream mathematics, like the symbols it used for "floor" and "ceiling". I don't think it's fair to characterize it as arbitrary or intentionally obtuse simply because mainstream languages went in a different direction.
|
# ? Feb 25, 2016 16:35 |
|
Subjunctive posted:Do you know of any languages where that works? All the languages I know of which support non-ASCII names (whether the source is encoded as UTF8 or something else) prohibit whitespace in those names. In Ruby only plain-old spaces are treated as semantic whitespace, which makes sense to me from a language design perspective, but one result is that identifiers can contain every other whitespace character.
|
# ? Feb 25, 2016 16:43 |
|
Doc Hawkins posted:In Ruby only plain-old spaces are treated as semantic whitespace, which makes sense to me from a language design perspective, but one result is that identifiers can contain every other whitespace character. Wow that is terrible design. Newlines aren't semantic whitespace? Tab characters? That's trippy poo poo.
|
# ? Feb 25, 2016 17:00 |
|
Internet Janitor posted:APL notation was specifically designed to try to unify the disparate notation used in mathematics for working with vectors, matrices and logic. While complaining about the overloaded behavior of some operators is valid, its syntax and semantics follow simple, consistent rules. Some of APL's notation even "stuck" and made its way into mainstream mathematics, like the symbols it used for "floor" and "ceiling". I don't think it's fair to characterize it as arbitrary or intentionally obtuse simply because mainstream languages went in a different direction. Wow I didn't know about floor/ceiling, that's cool.
|
# ? Feb 25, 2016 17:01 |
|
ErIog posted:The math world realized long ago that it has to contend with something the English-speaking programming world has convinced itself it doesn't need to deal with, and that's cooperation among people speaking different languages. Programmers are bigoted human garbage, news at 11.
|
# ? Feb 25, 2016 19:34 |
|
That's a p romantic view of mathematics but don't worry it's actually full of bigotry and is hecka anglocentric (and before that it was France and Germany, sometimes Russia but they mostly had their work stolen or ignored).
|
# ? Feb 25, 2016 20:13 |
|
Subjunctive posted:Newlines aren't semantic whitespace? Tab characters? That's trippy poo poo. Generally I believe that Ruby's lexer only treats ASCII-range characters specially, so all high-bit characters in 8-bit encodings are lumped together. Until Ruby 1.9 I believe Ruby only allowed ASCII characters to be used as identifiers, but now allows other, e.g., Unicode characters to be used (and quite possibly lumps them all together as "valid identifier characters"). Part of the reason for this is that Ruby has long tried to be encoding agnostic, and historically users have used EUC-JP or Shift-JIS just as much as UTF-8. One of the (perhaps scary) things about Ruby is that identifiers that start with capital letters (that is, [A-Z] in ASCII) are considered constants, and as a consequence, all class and module identifiers must start with a capital. Folks complain that non-ASCII Unicode capitals don't count for this purpose, but the reason is that capitalization and its rules (outside [A-Z]) is language/locale dependent, and they didn't want to go down that path.
|
# ? Feb 25, 2016 21:37 |
|
ExcessBLarg! posted:Doc is wrong, both newlines and tabs are. I don't know about \v and \f. yeah, you can see how they got to where they were by following a series of decisions that were individually justifiable given their goals for the language. but it doesn't really make sense to stay where they've got to. i don't think anyone sane would really complain about a breaking change that started forbidding loving whitespace in identifiers.
|
# ? Feb 25, 2016 21:54 |
|
carry on then posted:Humans are bigoted human garbage, news at 11.
|
# ? Feb 25, 2016 23:18 |
|
Soricidus posted:i don't think anyone sane would really complain about a breaking change that started forbidding loving whitespace in identifiers.
|
# ? Feb 25, 2016 23:46 |
|
Unicode defines the set of whitespace in each revision, no? Upgrade your libicu and you're done.
|
# ? Feb 25, 2016 23:47 |
|
Well Ruby doesn't use libicu. They probably have reasons for not wanting to use it either. It's also kind of weird, to me, that the way an interpreter parses code is dependent on the version of a dependent library that I have installed. I think it's a defensible approach, but I also don't think what Ruby does is particularly silly either.
|
# ? Feb 25, 2016 23:55 |
|
|
# ? May 17, 2024 17:52 |
|
I discovered today that Java allows ဪ in identifier names, but not 💩. I guess the first one counts as a letter, but the pile of poo is just a pile of poo.
|
# ? Feb 26, 2016 00:01 |