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
fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

what about lojban

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill

Shinku ABOOKEN posted:

there are real world languages where you only write what you say. hangul and arabic come to mind

there really aren't though. both those scripts encode things that are not pronounced (and omit things that are). yes, even hangul, despite korean propaganda claiming otherwise.

fart simpson posted:

what about lojban

that's not a real language

comedyblissoption
Mar 15, 2006

tef posted:

real chat: readable things have redundancy in them to aid meaning

I mn, y cn tk t th vwls, lv th cnsnts n, nd ts stll rdbl

orifyoulikeyoucanjustwritewithoutspaces
redundancy for the sake of redundancy can hurt readability is my point. creating intermediate variables when you could alternatively just simply describe the data flow can be worse to read.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

comedyblissoption posted:

redundancy for the sake of redundancy can hurt readability is my point. creating intermediate variables when you could alternatively just simply describe the data flow can be worse to read.

it can also be better; there are no one size fits all approaches

Cybernetic Vermin
Apr 18, 2005

this is p. silly, goes back to kolmogorov that you will be expressing things with redundancy if you don't have infinite time to express yourself ffs

Arcsech
Aug 5, 2008

comedyblissoption posted:

redundancy for the sake of redundancy can hurt readability is my point. creating intermediate variables when you could alternatively just simply describe the data flow can be worse to read.

counterpoint: the atrocity that is "point free style"

Arcsech
Aug 5, 2008
that said, in languages that have a |> operator I loving love it and use it all over the place

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!

Arcsech posted:

counterpoint: the atrocity that is "point free style"

which pointfree style,

code:
sum = foldl (+) 0
or
code:
foo = ap ((++) . flip f a) (join (flip y b))

Arcsech
Aug 5, 2008

Asymmetrikon posted:

which pointfree style,

code:
sum = foldl (+) 0
or
code:
foo = ap ((++) . flip f a) (join (flip y b))

both

if you are defining a function that takes arguments, then name the loving arguments

Arcsech
Aug 5, 2008

Arcsech posted:

both

if you are defining a function that takes arguments, then name the loving arguments

also don't name them poo poo like "a" and "b", come up with actual names that describe what they are

Cybernetic Vermin
Apr 18, 2005

kx k makes some weird choices, but i generally find that the fact that the default arguments for all functions are x, y and z (arity decided by use) actually does make for some readability

it is not like you ever, outside of intentional obfuscation, get anyone using x, y and z for anything but the first, second and third argument, and the compactness it brings makes it easy to give up stuff like currying and specialized rules for composition (though, granted, k has those too, which may not be as wise)

e.g. {x+y} is a function and you can fold it over a list like {x+y}/l. if you want to name stuff you go {[arg1;a2;etc] ...}

it is one of those things people like to think is obfuscating the language, but it is so trivial to remember that x is always the first argument that no one stumbles on that detail past the first five minutes, and it removes a lot of noise which in these kinds of circumstances really does distract from what is actually being done

Arcsech
Aug 5, 2008

Cybernetic Vermin posted:

kx k makes some weird choices, but i generally find that the fact that the default arguments for all functions are x, y and z (arity decided by use) actually does make for some readability

it is not like you ever, outside of intentional obfuscation, get anyone using x, y and z for anything but the first, second and third argument, and the compactness it brings makes it easy to give up stuff like currying and specialized rules for composition (though, granted, k has those too, which may not be as wise)

e.g. {x+y} is a function and you can fold it over a list like {x+y}/l. if you want to name stuff you go {[arg1;a2;etc] ...}

it is one of those things people like to think is obfuscating the language, but it is so trivial to remember that x is always the first argument that no one stumbles on that detail past the first five minutes, and it removes a lot of noise which in these kinds of circumstances really does distract from what is actually being done

it also does nothing to describe what the gently caress "x" means

variable names are documentation of the most essential kind. if you do not use descriptive names, you might as well use uuids for your variable/function names instead, saves you the effort of making sure you only have one "x" or "arg1" in a context

Moreleth
Jun 11, 2001

lego my eggo

leper khan posted:

it can also be better; there are no one size fits all approaches

except your mom

she really fits ALL

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
most of the time a longer name for a local variable is just longer.

{[number;number] number*number} is not clearer than {x*x}.

how many times have you written a loop with an induction variable and named it index or counter or i or whatever? it's a stereotypical pattern, not documentation. K makes x and y always have the same semantic meaning when you encounter them. stereotypical patterns like ,// and {x@<x} always look exactly the same, and there's a very good chance that two trained K programmers will come up with character for character identical programs to solve a given problem. this kind of uniformity is actually an extremely good thing for readability and maintenance, it just disagrees with conventional wisdom.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Internet Janitor posted:

most of the time a longer name for a local variable is just longer.

{[number;number] number*number} is not clearer than {x*x}.


ok but [number length * number width] is much clearer as it gives some idea as to your intent.

sarehu
Apr 20, 2007

(call/cc call/cc)
Clojure has the same feature, it works great as far as I can tell. Scala's underscore functions are like this too.

Cybernetic Vermin
Apr 18, 2005

Arcsech posted:

it also does nothing to describe what the gently caress "x" means

variable names are documentation of the most essential kind. if you do not use descriptive names, you might as well use uuids for your variable/function names instead, saves you the effort of making sure you only have one "x" or "arg1" in a context

this is precisely in the contexts where it is very small functions and the way they are being fitted together is more important to see than it is to interrupt the flow of the code with explanation

the pipelining and currying stuff, being a bit of specialized syntax, is a greater load than just making sure defining a small function can be done compactly enough to not obscure what the code is actually doing is what i am saying

Workaday Wizard
Oct 23, 2009

by Pragmatica

Arcsech posted:

that said, in languages that have a |> operator I loving love it and use it all over the place

same. i love it so much i sometimes catch myself writing value |> func even when i have just one function

ultravoices
May 10, 2004

You are about to embark on a great journey. Are you ready, my friend?

Arcsech posted:

both

if you are defining a function that takes arguments, then name the loving arguments

but what about all the bytes that are saved by naming alternating index variables i and j

gonadic io
Feb 16, 2011

>>=
all those compiler parsing cycles

or just general execution speed in a dynamic lang without a jit....

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
i prefer the (_|_) operater myself

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Arcsech posted:

it also does nothing to describe what the gently caress "x" means

variable names are documentation of the most essential kind. if you do not use descriptive names, you might as well use uuids for your variable/function names instead, saves you the effort of making sure you only have one "x" or "arg1" in a context
theyre not really necessary in every context e.g. where you're describing a straight-through sequence of steps or you have composing structures that capture patterns with more semantic accuracy. hence line labels haven't been particularly important in programming languages for about 40 years

Gazpacho fucked around with this message at 17:20 on Feb 23, 2017

Cybernetic Vermin
Apr 18, 2005

people who insist that every variable needs a descriptive name irregardless of context are only a slight evolution of the student turning in a programming assignment, having heard that the code should be well commented, with a mass of comments on the form // add 1 to the variable "numberOfElements", as another element has been counted

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Cybernetic Vermin posted:

people who insist that every variable needs a descriptive name irregardless of context are only a slight evolution of the student turning in a programming assignment, having heard that the code should be well commented, with a mass of comments on the form // add 1 to the variable "numberOfElements", as another element has been counted

otoh, a slightly-renamed function from our actual standard library:

code:
zCA(%1,%2)
	q %2-%1/365
if you're not looking at the implementation, how in the gently caress are you supposed to know what that does? also there's a bug in there that's less obvious because of the lovely variable names.

Cybernetic Vermin
Apr 18, 2005

true, but insisting on variable names may not even represent the function well. i am personally of the view that any function on it's own line should get a description as to what it is there to achieve, and while i am personally fine with a huge one-liner (pipeline if you wish) i feel the trade is that you describe what it achieves well enough that it can be rewritten if the programmer coming in later really cannot decipher the thing

the defensive way, of course, is to just demand all kinds of documentation at once, but you can really very easily obfuscate a clean implementation of something by requiring a ton of inline information

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
for (int arrayIndex

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

cis autodrag posted:

otoh, a slightly-renamed function from our actual standard library:

code:
zCA(%1,%2)
	q %2-%1/365
if you're not looking at the implementation, how in the gently caress are you supposed to know what that does? also there's a bug in there that's less obvious because of the lovely variable names.
is it a leap year bug, if so its not particularly obscure

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Gazpacho posted:

is it a leap year bug, if so its not particularly obscure

there is a leap year bug, but there's also a float precision bug that's easy to miss because the 365 makes your brain jump right to leap year.

and like i said, it's still bad because if you just see a call to that function it's gonna be hard to decipher unless the programmer who called it was kind enough to put the values they passed in into nicely named variables.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
i gotta say as late 1960s low-resource relic languages go, forth beats mumps all to hell

Cybernetic Vermin
Apr 18, 2005

oh yeah, forth would be 100% legit if it wasn't so different in approach and how a lot of the standard techniques don't go well with parallelism etc.

Doom Mathematic
Sep 2, 2008
i is a perfectly unambiguous name for a variable, it means "outermost loop index". j likewise means "second loop index" and so on.

Of course, if you're using i as the name of something other than the outermost loop index variable, you have indeed given your variable a bad name.

Bloody
Mar 3, 2013

i and j are good, k is okay, if you get into l/m/n you've probably hosed up

also "l" is the worst character

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
no its "u"

tef
May 30, 2004

-> some l-system crap ->

Shinku ABOOKEN posted:

there are real world languages where you only write what you say. hangul and arabic come to mind

/heh/

floatman
Mar 17, 2009
Just want to say that readable code can be created if programmers had good interpersonal communication skills and therefore would be able to figure out what some other person, who is not themselves, needs to know when reading code that they written, being able to put themselves in someone else's shoes and empathise.

Which means we're all hosed.

Ator
Oct 1, 2005

Richard Stallman posted:

To learn to be a good programmer, you'll need to recognize that certain ways of writing code, even if they make sense to you and they are correct, they're not good because other people will have trouble understanding them. Good code is clear code that others will have an easy time working on when they need to make further changes.

all we gotta do is convince humanity to empathize

Zemyla
Aug 6, 2008

I'll take her off your hands. Pleasure doing business with you!

Gazpacho posted:

i prefer the (_|_) operater myself

Bottom?

MeruFM
Jul 27, 2010

floatman posted:

Just want to say that readable code can be created if programmers had good interpersonal communication skills and therefore would be able to figure out what some other person, who is not themselves, needs to know when reading code that they written, being able to put themselves in someone else's shoes and empathise.

Which means we're all hosed.

all the knowledge in the world can't save the douchebag

Ator
Oct 1, 2005

page 444 of this haskell book and the authors still havent introduced monads

we havent even written a full program yet (that's not until chapter 13)

im burned out on this poo poo and going do something more relaxing this weekend

c++ networking

Adbot
ADBOT LOVES YOU

skimothy milkerson
Nov 19, 2006

Gazpacho posted:

i prefer the ( o Y o ) operater myself

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