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
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
just yesterday i fixed a bug in code with 100% path coverage which would have been prevented by rust's type system, but which even having fixed it i had no idea how i could possibly write a test which would trigger it

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Symbolic Butt posted:

I'm not even idealizing one supposed kind of "good testing suite" like those silver bullets. I'm saying that by mere virtue of having a testing suite at all already makes static type checking redundant.

you're an imbecile

raminasi
Jan 25, 2005

a last drink with no ice
i hate developing without a static type system. not for "program correctness" but just so i remember what the hell i'm doing. Fart SelectButt(List<Butt> butts) isn't complete documentation or anything but it gives great cognitive handholds. i worked in python a bit and always felt like i was in a fog.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Symbolic Butt posted:

don't gimmickshame please


I'm not even idealizing one supposed kind of "good testing suite" like those silver bullets. I'm saying that by mere virtue of having a testing suite at all already makes static type checking redundant.

and it's the 2010s, if you don't use vcs and write tests then I don't know what the gently caress

Not really though. Static typing helps guide new development to ensure that all API expectations are adhered to. It allows for efficient test suites that can throw generative test cases at the wall, using shared value generators.

It can guard against faulty assumptions about type working its way into the codebase, including the tests themselves, which can make it easier to onboard new developers safely.

I don't completely disagree that unit tests can replace a lot of static typing's benefits, however just like you can emulate almost any language feature in JavaScript because its very permissive, that doesn't mean it'll properly replace it -- especially in terms of the amount of assumptions you'll have to manually check.

This amount matters because humans have cognitive limits, and without some guarantees in the system details are more than likely to be missed in initial implementation, testing or code reviews.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Plorkyeran posted:

just yesterday i fixed a bug in code with 100% path coverage which would have been prevented by rust's type system, but which even having fixed it i had no idea how i could possibly write a test which would trigger it

I don't know how I feel about type inference, it's cool I guess and it's not the kind of "trivial static type checking" that I'm dissing itt

GrumpyDoctor posted:

i hate developing without a static type system. not for "program correctness" but just so i remember what the hell i'm doing. Fart SelectButt(List<Butt> butts) isn't complete documentation or anything but it gives great cognitive handholds. i worked in python a bit and always felt like i was in a fog.

for me it's like I don't care if butts is a list or whatever, it's just a thing that I'm taking butt objects from. duck typing birch

eventually I'll go back and decide the appropriate data structures and fix up the api for what I really need, and this is where I feel like dynamic typing has an advantage: static typing forces you to deal with a whole chain of type bureaucracy that doesn't matter most of the development time. and maybe it'll never matter anyway :whoa:

I know web development is a circus full of clowns but in this context full of fast changing apis it makes sense that dynamic typing is more prevalent


Maluco Marinero posted:

Static typing helps guide new development to ensure that all API expectations are adhered to.

this is a good argument and it's great to discredit the whole "api design guided by tdd thing" style that's so popular with ruby programmers

rip tdd thing, killed by static typing

b0lt
Apr 29, 2005

Symbolic Butt posted:

rip tdd thing, killed by static typing

type driven development

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

b0lt posted:

type driven development

this is basically how i do it

Soricidus
Oct 21, 2010
freedom-hating statist shill

Symbolic Butt posted:

for me it's like I don't care if butts is a list or whatever, it's just a thing that I'm taking butt objects from. duck typing birch

you're looking at this as though you're writing that method. I'm calling that method and I want to know what to pass it. what do you suggest, reading the code every time? just giving it whatever and hoping the test suite catches any resulting bugs? praying that the comments correctly document everything and are up to date?

a type signature tells me some of what I need to know in a trustworthy way. it's not perfect or infallible but it's good and useful.

Symbolic Butt posted:

eventually I'll go back and decide the appropriate data structures and fix up the api for what I really need, and this is where I feel like dynamic typing has an advantage

I guess static typing has fewer advantages if you're the only person working on something and you can just gently caress around with the api on a whim!

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Soricidus posted:

me, I'll carry on using all the crutches available to deal with the imperfect world I have to live in, where static typing remains useful

my dev philosophy.

write the simplest code possible so an idiot (myself) isn't as likely to gently caress up later

triple sulk
Sep 17, 2014



Symbolic Butt posted:

this is a good argument and it's great to discredit the whole "api design guided by tdd thing" style that's so popular with ruby programmers

rip tdd thing, killed by static typing

even in ruby land tdd was never that real (in the being used sense) of a thing. tbh it's always struck me as an ideal imagined up by people who have never had a single deadline to meet

brap
Aug 23, 2004

Grimey Drawer
sorry grandpa, web development's just too fast for your type system.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
static typing is for autists who literally want to create errors in their program where none would exist otherwise. types are a silly idea for 99% of applications cause it rarely matters how the computer stores a value internally.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

storage specification is the least important part of a type system

triple sulk
Sep 17, 2014



Tiny Bug Child posted:

static typing is for autists who literally want to create errors in their program where none would exist otherwise. types are a silly idea for 99% of applications cause it rarely matters how the computer stores a value internally.

lol

leftist heap
Feb 28, 2013

Fun Shoe
when did this become the new terrible programmers thread
static typing haters :getout:

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
dynamic typing is great for single developer tiny scripts that you will only ever run once

Notorious b.s.d.
Jan 25, 2003

by Reene

MononcQc posted:

Does it have inference? Erlang's got an optional type system too, and it gets rather well used around even on codebases that don't annotate anything. The type declarations can be used in documentation, analysis, tests (as quickcheck/PropEr generators). In practice the language remains dynamic, but you get to find type errors that would otherwise show themselves at runtime before then.

yes, common lisp usually has type inference. i.e. if you use the strongly typed primitives anywhere, sbcl does an ok job of optimization everywhere that touches a value that's known to have a type.

(but nobody uses those types, so it's moot)

Notorious b.s.d.
Jan 25, 2003

by Reene

comedyblissoption posted:

how long until a dynamically typed codebase invents its own system of ad hoc type documentation through comments or hungarian notation or statically typed transpiler

how many different ways do library authors end up documenting their types

this exists already

there are at least a dozen type systems for ruby, implemented via hacky faux-annotations or a nasty dsl or docstrings

none of them matter because optional typing devolves to no typing. it is human nature

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Notorious b.s.d. posted:

yes, common lisp usually has type inference. i.e. if you use the strongly typed primitives anywhere, sbcl does an ok job of optimization everywhere that touches a value that's known to have a type.

(but nobody uses those types, so it's moot)

does it do inference over non-primitive types?

VikingofRock
Aug 24, 2008




bobbilljim posted:

dynamic typing is great for single developer tiny scripts that you will only ever run once

IMO this is the only thing languages like python should be used for


Plorkyeran posted:

just yesterday i fixed a bug in code with 100% path coverage which would have been prevented by rust's type system, but which even having fixed it i had no idea how i could possibly write a test which would trigger it

This sounds pretty interesting--can you share any more details?

AWWNAW
Dec 30, 2008

do not engage type stymie

Notorious b.s.d.
Jan 25, 2003

by Reene

Subjunctive posted:

does it do inference over non-primitive types?

depends what you mean by "inference"

common lisp has a optional static type system for primitives -- strings, numbers, arrays and vectors of same. this poo poo gets optimized pretty well, since performance was the point of having this stuff in the standard.

common lisp also has a real, useful type system that can express useful ideas, in the form of CLOS. clos is a library for CL, much like moose is a library for perl implementing a real type system.

does it count as "inference" for non-CLOS code to seamlessly interoperate with legacy dynamic code and not raise compiler errors? :(

Notorious b.s.d.
Jan 25, 2003

by Reene

VikingofRock posted:

IMO this is the only thing languages like python should be used for

good languages are equally effective for your one-off scripts and your multi-year software projects

i unironically write scripts in scala. it supports shebang notation and everything

a friend of a friend does all his one-off sysadmin scripts in ocaml. he works in one of the world's only ocaml shops, so it makes a lot of sense in his context. why use a second language for scripting if your first one will do ?

VikingofRock
Aug 24, 2008




Notorious b.s.d. posted:

good languages are equally effective for your one-off scripts and your multi-year software projects

i unironically write scripts in scala. it supports shebang notation and everything

a friend of a friend does all his one-off sysadmin scripts in ocaml. he works in one of the world's only ocaml shops, so it makes a lot of sense in his context. why use a second language for scripting if your first one will do ?

I didn't mean to imply that good langs shouldn't be used for short scripts. I actually started semi-seriously learning haskell after I saw someone in this thread post some of their haskell CJ scripts.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

VikingofRock posted:

This sounds pretty interesting--can you share any more details?

it wasn't actually all that interesting; just some very slightly incorrect code for passing values between threads that was incorrect in a way that rust's borrow checker would have caught which resulted in data races on a value never used for control flow

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Notorious b.s.d. posted:

a friend of a friend does all his one-off sysadmin scripts in ocaml. he works in one of the world's only ocaml shops, so it makes a lot of sense in his context. why use a second language for scripting if your first one will do ?

one-off scripts tend to involve mostly calling other programs and munging strings, and most of the languages i would consider using for Real Programs are kinda bad at both of those

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Symbolic Butt posted:

I don't know how I feel about type inference, it's cool I guess and it's not the kind of "trivial static type checking" that I'm dissing itt
i didn't mention type inference?

Symbolic Butt posted:

for me it's like I don't care if butts is a list or whatever, it's just a thing that I'm taking butt objects from. duck typing birch

eventually I'll go back and decide the appropriate data structures and fix up the api for what I really need, and this is where I feel like dynamic typing has an advantage: static typing forces you to deal with a whole chain of type bureaucracy that doesn't matter most of the development time. and maybe it'll never matter anyway :whoa:
would it blow your mind if i told you that's how i often write c++? templates are duck typed but with compile time checking of if the thing looks like a duck rather than runtime

brap
Aug 23, 2004

Grimey Drawer
come on guys it's not like problems have ever happened because a value of the wrong type was passed to a function.

MononcQc
May 29, 2007

Notorious b.s.d. posted:

good languages are equally effective for your one-off scripts and your multi-year software projects

i unironically write scripts in scala. it supports shebang notation and everything
Same, but with Erlang obv.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Plorkyeran posted:

i didn't mention type inference?

oh, I just assumed that was the magic shenanigan that rust did to detect that error, I mean it has to be something more sophisticated than regular static type checking

Plorkyeran posted:

would it blow your mind if i told you that's how i often write c++? templates are duck typed but with compile time checking of if the thing looks like a duck rather than runtime

not really, I mean, I've seen some game developer once doing some kind of pseudo-duck typing on C++ but it looked gross and way too smart for his own good... so if it's not like that then it'd blow my mind sure I guess?

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

rrrrrrrrrrrt posted:

when did this become the new terrible programmers thread
static typing haters :getout:

so I can stay because I don't even hate static typing, it's you guys that are racist against dynamic typing :smug:

comedyblissoption
Mar 15, 2006

Notorious b.s.d. posted:

this exists already

there are at least a dozen type systems for ruby, implemented via hacky faux-annotations or a nasty dsl or docstrings

none of them matter because optional typing devolves to no typing. it is human nature
of course I know these exist

I'm more referring to what's the tipping point people have to usually reach in complexity/code size before they realize they need to add typing, realizing that lack of static typing is a bad idea

comedyblissoption
Mar 15, 2006

fleshweasel posted:

come on guys it's not like problems have ever happened because a value of the wrong type was passed to a function.
it really sounds like static typing is for holding the hands of dumb babby programmers who make novice mistakes like this

real programmers never dereference a null

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine
semi-serious q: what does having a static type system 'cost' you?? like I seriously don't get why you would prefer the alternatives

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

comedyblissoption posted:

it really sounds like static typing is for holding the hands of dumb babby programmers who make novice mistakes like this

anyone who has inherited a decent 6.5 figure + loc ruby codebase doesn't care who made the mistakes and just wants typing

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Soricidus posted:

you're looking at this as though you're writing that method. I'm calling that method and I want to know what to pass it. what do you suggest, reading the code every time? just giving it whatever and hoping the test suite catches any resulting bugs? praying that the comments correctly document everything and are up to date?

a type signature tells me some of what I need to know in a trustworthy way. it's not perfect or infallible but it's good and useful.

I'll concede that in a setting where people never document their functions, having the type signatures is better than nothing. :shobon:

Soricidus posted:

I guess static typing has fewer advantages if you're the only person working on something and you can just gently caress around with the api on a whim!

I didn't mean that, jesus guys it's like public api design is the only thing that matters in programming :rolleyes:

Symbolic Butt fucked around with this message at 03:53 on Apr 12, 2015

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Ploft-shell crab posted:

semi-serious q: what does having a static type system 'cost' you?? like I seriously don't get why you would prefer the alternatives

I'm bad at posting so here's a paper by professor tbc: https://courses.cs.washington.edu/courses/cse590n/10au/hanenberg-oopsla2010.pdf

Mr. Glass
May 1, 2009

quote:

Even though the experiment seems to suggest that static typing has no positive impact on development time it must not be forgotten that the experiment has some special conditions: the experiment was a one-developer experiment.

Brain Candy
May 18, 2006


other findings that an experiment using 45 hours of student coding into a write-only project would have found:

documentation doesn't help
comments are worthless
testing is worthless
there's no point to using source control

it's totally meaningless

Adbot
ADBOT LOVES YOU

Arcsech
Aug 5, 2008

Brain Candy posted:

it's totally meaningless

this but everything

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