|
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.
|
# ? Apr 6, 2013 23:49 |
|
|
# ? Jun 11, 2024 06:15 |
|
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
|
# ? Apr 6, 2013 23:53 |
|
getting over things not being 1 indexed is like the first thing you get over when you learn babbys first lang
|
# ? Apr 6, 2013 23:57 |
|
yaoi prophet posted:neither is inherently inferior but considering that basically everything uses 0-based you're stupid if you use 1-based why
|
# ? Apr 7, 2013 00:08 |
|
Zaxxon posted:Oh you are mad that tables aren't strictly arrays. Maybe that's why they didn't call them arrays.
|
# ? Apr 7, 2013 00:08 |
|
Seriouspost lua is a cool language but its niche is embedding inside C. It has like 2 libraries
|
# ? Apr 7, 2013 00:44 |
|
consistency is good when there's no reason to break it
|
# ? Apr 7, 2013 00:55 |
|
yaoi prophet posted:consistency is good when there's no reason to break it It's consistent with the language it's derived from
|
# ? Apr 7, 2013 01:24 |
|
I'm assuming you guys are all arguing hypothetically since you can start arrays at whatever index you want
|
# ? Apr 7, 2013 01:25 |
|
what like $[ in perl?
|
# ? Apr 7, 2013 01:30 |
|
vapid cutlery posted:I'm assuming you guys are all arguing hypothetically since you can start arrays at whatever index you want
|
# ? Apr 7, 2013 01:51 |
|
Nomnom Cookie posted:Seriouspost lua is a cool language but its niche is embedding inside C. It has like 2 libraries
|
# ? Apr 7, 2013 01:52 |
|
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
|
# ? Apr 7, 2013 02:31 |
|
unlike these brokebrain retards i don't have a mental crisis if i have to index from 1
|
# ? Apr 7, 2013 02:32 |
|
Gazpacho posted:ho ho not for long http://luvit.io/ lmao 2-4x faster than node even without the overhyped V8
|
# ? Apr 7, 2013 02:33 |
|
#define 1 0
|
# ? Apr 7, 2013 03:06 |
|
php arrays are god's own data type
|
# ? Apr 7, 2013 04:45 |
|
lists arent indexed hth
|
# ? Apr 7, 2013 04:50 |
|
gods own data type is probably some monstrous crazy typedefed struct. God is way into C. Hes been programming since the 70s.
|
# ? Apr 7, 2013 05:37 |
|
god is a java programmer
|
# ? Apr 7, 2013 05:40 |
|
god is programmed in perl 6
|
# ? Apr 7, 2013 05:43 |
|
friends in the quake.exe refer to it as their inner code
|
# ? Apr 7, 2013 05:48 |
|
god obv programmed in visbasic cuz the universe is poo poo
|
# ? Apr 7, 2013 06:07 |
|
http://www.softwarepreservation.org/projects/FORTRAN/paper/p165-backus.pdf heh things: monte carlo register allocation
|
# ? Apr 7, 2013 06:23 |
|
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.
|
# ? Apr 7, 2013 07:23 |
|
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. Too bad you typically don't manually index arrays in lua or this would be relevant
|
# ? Apr 7, 2013 07:28 |
|
not really PLchat but arrays are the best data structure and are indexed from 0
|
# ? Apr 7, 2013 07:29 |
|
shrughes posted:Source: years of experience coding in QBASIC.
|
# ? Apr 7, 2013 09:19 |
|
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 |
# ? Apr 7, 2013 10:07 |
|
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
|
# ? Apr 7, 2013 10:44 |
|
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"
|
# ? Apr 7, 2013 10:57 |
|
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
|
# ? Apr 7, 2013 11:04 |
|
Toady posted:for some reason, lua gets a pass for a lot of poo poo like: 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
|
# ? Apr 7, 2013 11:16 |
|
Toady posted:have to write "then" for every if statement, you will forget to do this forever shrughes posted:bwahahahaha
|
# ? Apr 7, 2013 11:20 |
|
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
|
# ? Apr 7, 2013 14:07 |
|
uG posted:god is programmed in perl 6 but he still writes perl 5 to get the universe runnin
|
# ? Apr 7, 2013 15:13 |
|
Toady posted:lack of control statements like continue and break hahaha
|
# ? Apr 7, 2013 18:22 |
|
wait a minute, lua has break, it just doesn't have continue. why are you trying to make me look like an idiot toady?
|
# ? Apr 7, 2013 18:31 |
|
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.
|
# ? Apr 7, 2013 19:06 |
|
|
# ? Jun 11, 2024 06:15 |
|
Philip Wadler posted:In any language design, the total time spent discussing
|
# ? Apr 7, 2013 19:14 |