|
hackbunny posted:a generic argument that's a (numeric) value instead of a type. like say, you have a dynamic list of poops and it's list<poop>, but a statically sized array of poops is array<poop, 420>: first generic argument is a type (the type of array elements), the second is an integral argument (the number of array elements) Powaqoatse posted:i think its like Array<3> so you know it only has 3 elements or Matrix<3,5> etc
|
# ? Aug 30, 2017 16:11 |
|
|
# ? May 22, 2024 15:10 |
|
i cant really find any articles online though, are they also called something else?
|
# ? Aug 30, 2017 16:15 |
|
sounds like a special case of dependent types to me.
|
# ? Aug 30, 2017 16:15 |
|
oh yeah that makes sense
|
# ? Aug 30, 2017 16:36 |
|
oh a size_t
|
# ? Aug 30, 2017 17:02 |
|
if it involves counting and type systems you're going to have an awful time
|
# ? Aug 30, 2017 17:49 |
|
tef posted:if it involves counting and type systems you're going to have an awful time I have 22 arguments about this
|
# ? Aug 30, 2017 22:19 |
|
All Too Much For Me posted:I have 22 arguments about this you'll need to provide a constructive proof of those 22 arguments or i'm not even going to compile them much less listen to them
|
# ? Aug 30, 2017 22:32 |
|
All Too Much For Me posted:I have 22 arguments about this
|
# ? Aug 30, 2017 22:41 |
|
is that 20+2 or 2+20 arguments? please construct a witness proving these are equivalent
|
# ? Aug 31, 2017 02:29 |
|
TOPS-420 posted:is that 20+2 or 2+20 arguments? please construct a witness proving these are equivalent wish I could construct a witness to your posts (who is not me)
|
# ? Aug 31, 2017 02:32 |
|
MALE SHOEGAZE posted:sounds like a special case of dependent types to me. Ralith fucked around with this message at 02:58 on Aug 31, 2017 |
# ? Aug 31, 2017 02:56 |
|
TOPS-420 posted:is that 20+2 or 2+20 arguments? please construct a witness proving these are equivalent how the gently caress do you prove a group axiom exactly
|
# ? Aug 31, 2017 03:13 |
|
very carefully
|
# ? Aug 31, 2017 03:45 |
|
lol if your type system can't express commutativity of addition in Z^n
|
# ? Aug 31, 2017 04:19 |
|
Sapozhnik posted:how the gently caress do you prove a group axiom exactly It depends on how you define the particular group.
|
# ? Aug 31, 2017 04:46 |
|
Ralith posted:people say this a lot and it bugs me, because the coolest part of real dependent types is that you don't need to know the actual value your type depends on at compiletime. in C syntax, you can do stuff like struct { size_t n; int foo[n]; } obviously there would be many things swift would not allow, but we could actually handle some amount of dynamicism here
|
# ? Aug 31, 2017 06:46 |
|
hackbunny posted:a generic argument that's a (numeric) value instead of a type. like say, you have a dynamic list of poops and it's list<poop>, but a statically sized array of poops is array<poop, 420>: first generic argument is a type (the type of array elements), the second is an integral argument (the number of array elements) Didn't Pascal have this? And it was turned on by default, as in every array was sized and the size was part of the array type? And it was one of the worst features of Pascal?
|
# ? Aug 31, 2017 11:00 |
|
pascal had fixed-size arrays and iirc no portable way to generalize over them. allowing code to be generic over an integer does give you a way to generalize over them (as would e.g. allowing them to decay to a pointer/length pair, or even just a pointer as c does)
|
# ? Aug 31, 2017 15:04 |
|
ansi pascal had no polymorphism over array sizes and no dynamically sized array or string types, so you could only write a function for a specific array size e: fb
|
# ? Aug 31, 2017 15:07 |
|
Pascal was the second language i learned after quickbasic i remember basically nothing about it other than how frustrated i was at array sizes
|
# ? Aug 31, 2017 15:49 |
|
rjmccall posted:pascal had fixed-size arrays and iirc no portable way to generalize over them. allowing code to be generic over an integer does give you a way to generalize over them (as would e.g. allowing them to decay to a pointer/length pair, or even just a pointer as c does) so to get around this you would what? declare a larger array and fill up what you weren't using with null and write boilerplate to strip it out?
|
# ? Aug 31, 2017 16:30 |
|
Relevant http://doc.cat-v.org/bell_labs/why_pascal/why_pascal_is_not_my_favorite_language.pdf
|
# ? Aug 31, 2017 16:44 |
|
https://doc.rust-lang.org/std/primitive.array.html
|
# ? Aug 31, 2017 17:00 |
|
ultravoices posted:so to get around this you would what? declare a larger array and fill up what you weren't using with null and write boilerplate to strip it out? if you need a dynamically-sized array then yeah, you can just treat the length as a max capacity and store a size along with it. the basic set-up is not that different from c except that c actually gives you the ability to form pointers
|
# ? Aug 31, 2017 17:06 |
|
but pascal does have pointers? hell, it's how I learned pointers. or was it a borland extension
|
# ? Aug 31, 2017 17:26 |
|
Gazpacho posted:Relevant http://doc.cat-v.org/bell_labs/why_pascal/why_pascal_is_not_my_favorite_language.pdf today this would be "pascal_is_a_piece_of_shit_for_morons.pdf"
|
# ? Aug 31, 2017 17:32 |
|
akadajet posted:today this would be "pascal_is_a_piece_of_shit_for_morons.pdf" He's canadian. "not my favorite" is canadianese for "poo poo from a butt"
|
# ? Aug 31, 2017 17:38 |
|
is pascal the original p-lang?
|
# ? Aug 31, 2017 17:45 |
|
ansi pascal had pointers, but you could only alloc/delete single values iirc. you could build a linked list or tree but you couldn't do pointer arithmetic turbo pascal fixed basically all the problems with pascal by making string a proper type and adding c-style pointer arithmetic e: also by having the greatest compiler box art of all time TOPS-420 fucked around with this message at 18:10 on Aug 31, 2017 |
# ? Aug 31, 2017 17:45 |
|
akadajet posted:is pascal the original p-lang? MORE LIKE P-LANG
|
# ? Aug 31, 2017 18:47 |
|
hackbunny posted:but pascal does have pointers? hell, it's how I learned pointers. or was it a borland extension it has pointers, but there’s no standard ability to take the address of things, or to do pointer arithmetic, so you can’t use pointers as a generalization mechanism the way you can in c
|
# ? Aug 31, 2017 18:48 |
|
Gazpacho posted:Relevant http://doc.cat-v.org/bell_labs/why_pascal/why_pascal_is_not_my_favorite_language.pdf kind of interesting to see someone talk about how cool and good (function-level) static is and how lame pascal is for not having it
|
# ? Aug 31, 2017 19:03 |
|
raminasi posted:kind of interesting to see someone talk about how cool and good (function-level) static is and how lame pascal is for not having it i'm a dumb baby, that is 1980-ese for a global variable, right?
|
# ? Aug 31, 2017 19:04 |
|
raminasi posted:kind of interesting to see someone talk about how cool and good (function-level) static is and how lame pascal is for not having it welcome to the golang party
|
# ? Aug 31, 2017 19:18 |
|
ultravoices posted:i'm a dumb baby, that is 1980-ese for a global variable, right? The PDF posted:A static variable (often called an own variable in Algol-speaking countries) is one that is private to some routine and retains its value from one call of the routine to the next. So it's scoped to the function, but keeps its value between calls.
|
# ? Aug 31, 2017 19:20 |
|
right. it's not like pascal is taking a principled stand against global variables, it's just forcing them to be declared as true globals instead of allowing them to be function-scoped. also note that pascal requires global variables to be declared in a single block at the top of the source file so that might be really far away from the function definition
|
# ? Aug 31, 2017 19:23 |
|
I've heard many people speak praise of modern FreePascal and the Lazarus ide in particular, never actually checked it out myself but I'm kinda curious. Supposedly it's quite good at cross platform GUI development
|
# ? Aug 31, 2017 19:41 |
|
CPColin posted:So it's scoped to the function, but keeps its value between calls. okay you sort of can do that in python by with hasattr, it will retain state between function calls but the attribute will be accessible from outside the scope of the function.
|
# ? Aug 31, 2017 20:43 |
|
|
# ? May 22, 2024 15:10 |
|
TOPS-420 posted:ansi pascal had no polymorphism over array sizes and no dynamically sized array or string types, so you could only write a function for a specific array size talk about a swing and a miss
|
# ? Aug 31, 2017 20:46 |