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
Athas
Aug 6, 2007

fuck that joker

eschaton posted:

code is read far more than it’s written so it’s good and proper to be as verbose and explicit as possible, with a minimum of memorization required on the part of the reader

I like short names precisely because it is easier when reading the code (when you can remember what the names mean). I think my brain ends up doing more symbol/image recognition and less conscious reading when processing terse code. For various other reasons I don't like going all the way to APL (mostly because you cannot add abstractions to APL without losing this advantage), but consistent terseness can made code read much more like a precise formula than some lumbering essay.

Edit: but let me repeat this is mostly for frequently used building block functions and such. I'm fine with giving long and clumsy names to exotic functions that are almost never called. Perl for example gets this completely backwards by having single-symbol global variables that change subtle things about the language and runtime system.

Adbot
ADBOT LOVES YOU

repiv
Aug 13, 2009

fart simpson posted:

i think this is what rust does?

yes rust uses i32, f64, etc

those are too terse to be readable though, they should be ThirtyTwoBitTwosComplementSignedInteger and InstituteOfElectricalAndElectronicsEngineersDoublePrecisionFloatingPoint instead

Plank Walker
Aug 11, 2005
i actually like most of modern javascript's syntax but i absolutely hate the naming of standard global objects
stringify? globalThis? array push and pop instead of add/remove? no thanks

Soricidus
Oct 21, 2010
freedom-hating statist shill
the push/pop thing is because js is actually heavily influenced by perl. see also use strict

tinaun
Jun 9, 2011

                  tell me...

RPATDO_LAMD posted:

there are so many std library types that are as short as possible at the expense of readability
what's a cow? mpsc? rc?

rust used to have a rule where no keyword or std type should have a name longer than 5 letters, so you had ret for return and loop instead of continue (and even sillier stuff like iface instead of trait). they got rid of that ages ago but it still lingers in places

the whole String/str split is one of many things about rust that hasn't really hindered me in large projects but it makes whiteboard-tier toy programs more annoying than they should be

Bloody
Mar 3, 2013

long names suck tbh

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


Bloody posted:

long names suck tbh

yeah sometimes, but then, well,

let me quote from the code I'm rewriting right now:

e: actually in retrospect copyright compliance etc, etc, let's just say there's a lot of two- and three-letter non-local variables

which is to say, I'd rather deal with an extra word in a symbol than try to figure out what nhr, ndr and ndx are (and no it's not "number", it's new header row, new dictionary row and new dictionary row x offset) and what the compounded ternary does with them

Private Speech fucked around with this message at 16:17 on Jul 8, 2020

Truman Peyote
Oct 11, 2006



code:
sliceLength := len(slice)
for currentIndex = 0; currentIndex < sliceLength; currentIndex++ {
    do(slice[currentIndex])
}

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
it's not enjoyable having to check docs constantly to see what names mean. if you memorize them, that works. if a longer name adds hints, that works too

if long names offend your column limit or whatever, you might consider adapting your style and editor for the code at hand! weird!

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


oh, yeah, docs

could use some of those





I do have doxygen set up but I don't really have time for it right now

Vanadium
Jan 8, 2005

tinaun posted:

rust used to have a rule where no keyword or std type should have a name longer than 5 letters, so you had ret for return and loop instead of continue (and even sillier stuff like iface instead of trait). they got rid of that ages ago but it still lingers in places

the whole String/str split is one of many things about rust that hasn't really hindered me in large projects but it makes whiteboard-tier toy programs more annoying than they should be

They also has "cont" instead of "continue" until someone pointed out they were uncomfortable saying that our loud, or something.

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer

fart simpson posted:

yeah and i hate when people use the + operator instead of the add function
i actually went to check the smalltalk docs to see if they had something fun but apparently you can pass a message called +

quote:

+ aNumber
Sum the receiver and aNumber, answer the result

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
smalltalk has operators but no concept of precedence so x * x + y * y actually computes ((x * x) + y) * y

eschaton and a bunch of other lisp idiots will fervently defend this, of course

like check out this scintillating conversation between programming's greatest lights

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
actually it's basically fine in a language like lisp or forth where you can't write things in infix style to begin with so there's no confusion. i mean i don't like it, i find that the infix syntax promotes much more readable code (although of course you can abuse it to make code that's completely unapproachable by novices), but it's not actively problematic

smalltalk's choice is an attractive nuisance: it lets you write things that look right and have a standard interpretation and then gives them a non-standard interpretation that breaks them. this is unavoidable in languages with infix, which is why they all have precedence except for a few exceptions written by idiots

distortion park
Apr 25, 2011


I would have agreed with you in the past but then I did some q and having line order precedence is actually pretty nice

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

repiv posted:

yes rust uses i32, f64, etc

those are too terse to be readable though, they should be ThirtyTwoBitTwosComplementSignedInteger and InstituteOfElectricalAndElectronicsEngineersDoublePrecisionFloatingPoint instead

c also has this, although not for floats for reasons

Sapozhnik
Jan 2, 2005

Nap Ghost
I wouldn't have minded if RPN arithmetic became the standard for programming languages and persisted through inertia but that's not the world we ended up in today.

There's a case to be made for matching scientific and engineering notation conventions with hundreds of years of history behind them, sure, but if you go too far down that tradition rabbit hole you end up with crap like 4GLs and SQL.

Cybernetic Vermin
Apr 18, 2005

it is one of those things you learn in no time, so it is kind of whatever. otoh ruby just added operator precedence to smalltalk and it worked out just fine (in that regard at least).

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
there is basically no good reason not to do precedence if you're doing infix operators, it is dead simple to implement and it means you interpret simple expressions the way people expect them to be interpreted instead of leaving a weird gotcha for when someone finally uses a numeric formula for the first time

the problem i see is that languages often do precedence and then think they have to have precedence relationships for everything. if there isn't an obvious ordering between two operators, it's okay to leave them unordered and make using them in adjacent positions an error

psiox
Oct 15, 2001

Babylon 5 Street Team

thanks, this is kinda great!

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer

rjmccall posted:

there is basically no good reason not to do precedence if you're doing infix operators, it is dead simple to implement and it means you interpret simple expressions the way people expect them to be interpreted instead of leaving a weird gotcha for when someone finally uses a numeric formula for the first time

the problem i see is that languages often do precedence and then think they have to have precedence relationships for everything. if there isn't an obvious ordering between two operators, it's okay to leave them unordered and make using them in adjacent positions an error

i was going to ask this. are there any languages that accept traditional notation but refuse to mix it with non-traditional operators? like you can use regular arithmetic operators with "normal" bimdas precedence but it just refuses to allow bit shifting or pre/post increment or any custom operators in the same expression

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
i don't know any. swift's precedence system is capable of expressing that, and new operators by default don't associate with anything (including themselves) except for parsing tighter than assignment. but when we added that whole system, we just took the existing numeric operator precedences and preserved their effect in the new system, which was really a missed opportunity. we did fix some of c's precedences but overall too many things still have precedence relationships, they're just better precedence relationships

Soricidus
Oct 21, 2010
freedom-hating statist shill

psiox posted:

thanks, this is kinda great!

actually it’s worthless trash. the reason regexes can become unreadable is nothing to do with syntax so changing the syntax is only going to be a negative: it won’t make things any better so you’re just using something nonstandard for no good reason. know what makes code hard to read? doing that.

animist
Aug 28, 2018
just use a parser generator if you need parsing code to be readable imo

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

pokeyman posted:

if long names offend your column limit or whatever, you might consider adapting your style and editor for the code at hand! weird!

and also for the 80s, when UIs that supported scrolling became commonplace

80-column limits are bullshit and I say this as a person who has many character terminals and even a teletype

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Destroyenator posted:

i actually went to check the smalltalk docs to see if they had something fun but apparently you can pass a message called +

classical Smalltalk does indeed have a small number of single-character one-argument method names, representing the most common arithmetic operations; some modern Smalltalks add a small number of multi-character method names sans colon too, typically those from C

this may have actually been a mistake that’s led to bugs, since it does not have mathematical operator precedence:

code:
    Console print: (4 + 3 * 2).
will print 14 rather than 10 because the evaluation is left-to-right (which is also why the parentheses are needed)

and of course the Smalltalk dialects that have added the C operators also just evaluate left-to-right, because they’re Smalltalk

other than pretty much this single wart, the Smalltalk grammar is extremely simple, to a similar degree as Lisp, and it’s very nice to construct a system within

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

rjmccall posted:

smalltalk has operators but no concept of precedence so x * x + y * y actually computes ((x * x) + y) * y

eschaton and a bunch of other lisp idiots will fervently defend this, of course

like check out this scintillating conversation between programming's greatest lights

actually I wouldn’t defend Smalltalk on this front, I think it misleads people and add: might have been better

Lisp doesn’t have the same degree of ambiguity, though it has its own kind what with selective evaluation in special forms and the ability to create new ones with macro

animist
Aug 28, 2018
people are talking about more seriously bringing rust into the Linux kernel. there's going to be so much graybeard whining

pseudorandom name
May 6, 2007

why?

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

animist posted:

people are talking about more seriously bringing rust into the Linux kernel. there's going to be so much graybeard whining

i'll believe it when "people" includes linus torvalds

Vanadium
Jan 8, 2005

Linus seems down with it, or at least resigned to it.

https://lkml.org/lkml/2020/7/10/1261
https://thenewstack.io/linus-torvalds-on-diversity-longevity-rust-and-arm-chips/

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
They say a picture is worth a thousand words.

:suspense:

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang




they will whine with or without rust

Sapozhnik
Jan 2, 2005

Nap Ghost
I'll be interested to see what bright line makes C++ unacceptable but Rust acceptable.

C has seen a great many :pcgaming: REVOLUTIONARY NEW PARADIGM :pcgaming: languages come and go over the years. You would probably need 1TB of RAM and some very high single-threaded performance indeed to compile a hypothetical Rust-ified Linux kernel in any reasonable amount of time, which is certainly not a point in favor of its adoption.

Sapozhnik fucked around with this message at 00:15 on Jul 12, 2020

redleader
Aug 18, 2005

Engage according to operational parameters
i guess c++ is the best things can ever get

Vanadium
Jan 8, 2005

Sapozhnik posted:

C has seen a great many :pcgaming: REVOLUTIONARY NEW PARADIGM :pcgaming: languages come and go over the years.

fwiw this is the justification a prev workplace gave for using a Delphi from 1999 and INTERBASE in 2015, and I think also for not using version control

Falcorum
Oct 21, 2010

Vanadium posted:

fwiw this is the justification a prev workplace gave for using a Delphi from 1999 and INTERBASE in 2015, and I think also for not using version control

eh, could be worse, they could be using perforce

Cybernetic Vermin
Apr 18, 2005

Vanadium posted:

fwiw this is the justification a prev workplace gave for using a Delphi from 1999 and INTERBASE in 2015,

which, if it did the thing it what supposed to and let people clock out at four, is a fine argument.

Vanadium posted:

and I think also for not using version control

which is not.

The_Franz
Aug 8, 2003

Sapozhnik posted:

I'll be interested to see what bright line makes C++ unacceptable but Rust acceptable.

C has seen a great many :pcgaming: REVOLUTIONARY NEW PARADIGM :pcgaming: languages come and go over the years. You would probably need 1TB of RAM and some very high single-threaded performance indeed to compile a hypothetical Rust-ified Linux kernel in any reasonable amount of time, which is certainly not a point in favor of its adoption.

by the time you stripped everything not suitable for a kernel environment out of c++, you'd basically just be left with c with basic classes, and even then there would be restrictions (e.g. no allocating in constructors)

Adbot
ADBOT LOVES YOU

animist
Aug 28, 2018
I mean you *can* write a kernel in Java or whatever it's just a terrible idea

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