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
Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

Police Academy III posted:

a list is a sequential series of elements indexed by numbers. if you try to insert something into an index that isn't a number it should tell you to gently caress off instead of magically changing into something that sort of works like a list but isn't. if you do that then you're php level stupid.

Oh you are mad that tables aren't strictly arrays. Maybe that's why they didn't call them arrays.

Adbot
ADBOT LOVES YOU

Opinion Haver
Apr 9, 2007

vapid cutlery posted:

0 vs 1-based indexing is completely irrelevant to anything

neither is inherently inferior but considering that basically everything uses 0-based you're stupid if you use 1-based

uG
Apr 23, 2003

by Ralp
getting over things not being 1 indexed is like the first thing you get over when you learn babbys first lang

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

yaoi prophet posted:

neither is inherently inferior but considering that basically everything uses 0-based you're stupid if you use 1-based

why

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Zaxxon posted:

Oh you are mad that tables aren't strictly arrays. Maybe that's why they didn't call them arrays.

Nomnom Cookie
Aug 30, 2009



Seriouspost lua is a cool language but its niche is embedding inside C. It has like 2 libraries

Opinion Haver
Apr 9, 2007


consistency is good when there's no reason to break it

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

yaoi prophet posted:

consistency is good when there's no reason to break it

It's consistent with the language it's derived from

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
I'm assuming you guys are all arguing hypothetically since you can start arrays at whatever index you want

Opinion Haver
Apr 9, 2007

what like $[ in perl?

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

vapid cutlery posted:

I'm assuming you guys are all arguing hypothetically since you can start arrays at whatever index you want
and i bet you're crazy enough to actually do it

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Nomnom Cookie posted:

Seriouspost lua is a cool language but its niche is embedding inside C. It has like 2 libraries
ho ho not for long http://luvit.io/

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Gazpacho posted:

and i bet you're crazy enough to actually do it

that would be dumb if only because of how the # operator works

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
unlike these brokebrain retards i don't have a mental crisis if i have to index from 1

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

lmao 2-4x faster than node even without the overhyped V8

coaxmetal
Oct 21, 2010

I flamed me own dad
#define 1 0

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
php arrays are god's own data type

Carthag Tuek
Oct 15, 2005

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



lists arent indexed hth

coaxmetal
Oct 21, 2010

I flamed me own dad
gods own data type is probably some monstrous crazy typedefed struct. God is way into C. Hes been programming since the 70s.

Nomnom Cookie
Aug 30, 2009



god is a java programmer

uG
Apr 23, 2003

by Ralp
god is programmed in perl 6

tef
May 30, 2004

-> some l-system crap ->
friends in the quake.exe refer to it as their inner code

stoutfish
Oct 8, 2012

by zen death robot
god obv programmed in visbasic cuz the universe is poo poo

tef
May 30, 2004

-> some l-system crap ->
http://www.softwarepreservation.org/projects/FORTRAN/paper/p165-backus.pdf

heh

things: monte carlo register allocation

shrughes
Oct 11, 2008

(call/cc call/cc)

yaoi prophet posted:

neither is inherently inferior but considering that basically everything uses 0-based you're stupid if you use 1-based

No. 0-based is inherently superior. Try writing some actual code. How do you represent array partitions? With 0-based indexing, it's [0, k), [k, n). With 1-based indexing, it's [1, k), [k, n]? [1, k], [k + 1, n]? (0, k], (k, n]? The last is pretty nice... if you're iterating backwards.

1-based array indexing invariably gets laced with +1's and -1's to deal with the awkwardness of its design. Things line up less well and you're more likely to have off-by-one errors. 0-based indexing and half-open intervals to represent array slices is the cleanest option.

Source: years of experience coding in QBASIC.

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

shrughes posted:

No. 0-based is inherently superior. Try writing some actual code. How do you represent array partitions? With 0-based indexing, it's [0, k), [k, n). With 1-based indexing, it's [1, k), [k, n]? [1, k], [k + 1, n]? (0, k], (k, n]? The last is pretty nice... if you're iterating backwards.

1-based array indexing invariably gets laced with +1's and -1's to deal with the awkwardness of its design. Things line up less well and you're more likely to have off-by-one errors. 0-based indexing and half-open intervals to represent array slices is the cleanest option.

Source: years of experience coding in QBASIC.

Too bad you typically don't manually index arrays in lua or this would be relevant

Nomnom Cookie
Aug 30, 2009



not really PLchat but arrays are the best data structure and are indexed from 0

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

shrughes posted:

Source: years of experience coding in QBASIC.
qbasic doesn't 1-index though? with MS basics there were a some dopey hobbyists who went around teaching people to 1-index but i'm p sure the interpreters actually started at 0

shrughes
Oct 11, 2008

(call/cc call/cc)

Gazpacho posted:

qbasic doesn't 1-index though? with MS basics there were a some dopey hobbyists who went around teaching people to 1-index but i'm p sure the interpreters actually started at 0

Oh.

I might have dimmed them from 1 to N. Or maybe it was some other basic??

Edit: No, I probably dimmed them as purely (N) and used them from 1 to N. I think that's how the help might have taught, too.

shrughes fucked around with this message at 10:10 on Apr 7, 2013

Toady
Jan 12, 2009

lua "arrays" suck because you can insert nil into them and create a gap which fucks up a bunch of things including the value returned by the length operator. combine that with silently returning nil for undefined element and variable accesses and it's fun times

don't mention any of this on the lua mailing list because the people there declare the language to be perfect

Toady
Jan 12, 2009

for some reason, lua gets a pass for a lot of poo poo like:

no unicode and no plans for it beyond a couple of utf8 functions someday

(0) is true. (0 == true) is false

lack of control statements like continue and break contribute to deeply indented sections of code in large programs. fear not, 5.2 introduced goto with a ::label:: syntax

no runtime errors for things like undefined variable/element accesses leads to people running static analyzers just to catch dumb typos

have to write "then" for every if statement, you will forget to do this forever

but don't tell mention lua's weirdness on any forum or mailing list anywhere because fans will come out of the woodwork to tell you you're just not "used to it" or that it's "beautiful"

Cybernetic Vermin
Apr 18, 2005

having undefined elements return nil sounds like a worse idea than it is. have undefined things be nil, and have nil cascade through operations where it makes sense. there are tons of upsides to this, such as allowing error checking to be deferred and centralized when convenient, and plain being able to perform calculations on "incomplete" data in cases where the results depending on the missing pieces are irrelevant anyway, without having to write a bunch of extra code. early failures end up being a bit like checked exceptions everywhere, it is less convenient and more fragile than one likes to picture it

i don't know enough about lua to know if this is realized there, but one of my favourite languages of all time use nils for undefined in a way that has huge payoffs

shrughes
Oct 11, 2008

(call/cc call/cc)

Toady posted:

for some reason, lua gets a pass for a lot of poo poo like:

no unicode and no plans for it beyond a couple of utf8 functions someday

that's not unreasonable, there's no reason why a language should have to have unicode

Toady posted:

(0) is true. (0 == true) is false

that's perfectly reasonable, for example Scheme will do that sort of thing.

Toady posted:

lack of control statements like continue and break contribute to deeply indented sections of code in large programs. fear not, 5.2 introduced goto with a ::label:: syntax

so they avoided overdesigning the language and now they fixed the hole with a superior and orthogonal feature.

Toady posted:

no runtime errors for things like undefined variable/element accesses leads to people running static analyzers just to catch dumb typos

well, it is the way it is. some things are just how the language works, there's nothing you can do to fix that.

Toady posted:

have to write "then" for every if statement, you will forget to do this forever

bwahahahaha

Toady posted:

but don't tell mention lua's weirdness on any forum or mailing list anywhere because fans will come out of the woodwork to tell you you're just not "used to it" or that it's "beautiful"

i'm shocked, shocked that they're sick and tired of smuglords telling them things they already about their language

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Toady posted:

have to write "then" for every if statement, you will forget to do this forever

shrughes posted:

bwahahahaha

krisis
Oct 25, 2003

i have a light case of asparagus.

quote:

By the summer of 1956 what appeared to be the imminent completion of the project started us worrying (for perhaps the first time) about documentation.

good to know that nothing ever changes

EVGA Longoria
Dec 25, 2005

Let's go exploring!

uG posted:

god is programmed in perl 6

but he still writes perl 5 to get the universe runnin

Police Academy III
Nov 4, 2011

Toady posted:

lack of control statements like continue and break

hahaha

Police Academy III
Nov 4, 2011
wait a minute, lua has break, it just doesn't have continue. why are you trying to make me look like an idiot toady?

Vanadium
Jan 8, 2005

Toady posted:

have to write "then" for every if statement, you will forget to do this forever

I don't mind lua but this is absolutely true.

Adbot
ADBOT LOVES YOU

MononcQc
May 29, 2007

Philip Wadler posted:

In any language design, the total time spent discussing
a feature in this list is proportional to two raised to
the power of its position.
    0. Semantics
    1. Syntax
    2. Lexical syntax
    3. Lexical syntax of comments
(That is, twice as much time is spent discussing syntax
than semantics, twice as much time is spent discussing
lexical syntax than syntax, and twice as much time is
spent discussing syntax of comments than lexical syntax.)

With the exception of comments, I would say discussion so far
conforms to this observation.

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