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
Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Mr. Glass posted:

what if i told you this language already exists

go on...

Adbot
ADBOT LOVES YOU

comedyblissoption
Mar 15, 2006

proponents of dynamic typing may not usually realize popular statically typed languages like C# have at least good enough type inference, lambdas, and higher order functions which would be contrary to their experience w/ older versions of C++/java

even java/C++ kind of have those now

looking at languages inspired by ml (e.g. F#, ocaml, haskell) kind of makes it obvious static typing does not imply unnecessary boilerplate and makes it more difficult to see the advantages of dynamic typing

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Soricidus posted:

e: every time this comes up I start thinking that really what I want is optional typing, is that mainstream yet

php7

comedyblissoption
Mar 15, 2006

c# has static typing by default and an optional dynamic keyword for dynamic typing

that's probably a much better approach than dynamic typing by default w/ optional static typing if you care about things like reading a program later

leftist heap
Feb 28, 2013

Fun Shoe

haskell has all those things :mrgw:

comedyblissoption
Mar 15, 2006

some people on the internets are even confused and think that static type inference is dynamic typing
http://stackoverflow.com/questions/3647824/why-use-dynamic-typing-in-c

comedyblissoption
Mar 15, 2006

there's basically no experimental way you could verify whether dynamic typing or static typing is better than the other for real world programming projects

you'd need a large sample size of multi-year multi-developer projects w/ developers of similar skillsets w/ regular project attrition using different static and dynamically typed languages all solving the same problem but in a way that a particular language's frameworks and library ecosystem doesn't give them a significant advantage over other languages

and there'd still be bikeshedding about the languages chosen and languages that haven't been invented yet

CPColin
Sep 9, 2003

Big ol' smile.

Shinku ABOOKEN posted:

this is why i was playing with kotlin

saying val todolist = ArrayList<Butt>() is much better than ArrayList<Butt> todolist = new ArrayList<Butt>()

And in between the two is List<Butt> todolist = new ArrayList<>().

brap
Aug 23, 2004

Grimey Drawer
type inference is just a loving quality of life thing. Foo foo = new Foo() is exactly why plangers mock java. the traditional strengths of dynamic languages can effectively be brought to static languages. that's why i like the swift language.

comedyblissoption
Mar 15, 2006

oh wow java still doesn't have type inference for variable declarations like
code:
var butts = GetButts();
and it mostly looks like because of a very wrong philosophical belief and obviously not any technical limitation

lol

comedyblissoption
Mar 15, 2006

even when a language has type inference for variable declarations, there will still be a camp that insists on not using it as a general rule
http://www.brad-smith.info/blog/archives/336

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Notorious b.s.d. posted:

scala and groovy let you have your static type system on the jvm without spending time typing out boilerplate. flexible like a scripting language, typechecked like java

we're investigating groovy/grails for a system we're rolling out and groovy really seems like a wet dream. static typing and a REPL, thank you.

although I havent really gotten into groovy too deeply yet. it kinda seems like types are optional which is bleh. scala might be nicer but egh

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

comedyblissoption posted:

even when a language has type inference for variable declarations, there will still be a camp that insists on not using it as a general rule
http://www.brad-smith.info/blog/archives/336

I'll admit that I don't love

code:

var butt = GetButts();

because it gives up the documentary value of the types. if you have a good IDE to cope with that I guess it's OK, but without it you find yourself chasing declarations a lot.

otoh I don't really mind

code:

GetButts().KickAll();

which has the same issue, so it's not a principled stance

comedyblissoption
Mar 15, 2006

If people are working with development environments that don't let them easily find the return type of a function, they should get or demand better development environments. This is true regardless of whether or not the language supports type inference or your project's policy on type inference.

Even if someone makes an error in type because someone made a wrong assumption about the type of Butts, the compiler will catch the error for them. Only very contrived cases would allow both an error in type by both the compiler and programmer.

sarehu
Apr 20, 2007

(call/cc call/cc)

Subjunctive posted:

otoh I don't really mind

code:

GetButts().KickAll();

which has the same issue, so it's not a principled stance

In this case though, immediately seeing that it has a KickAll method gives you some information about the type, if you're familiar with the codebase. Also the value is immediately discarded, which means it's not occupying your mental symbol table with incomplete information as you read later parts of the function.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

comedyblissoption posted:

c# has static typing by default and an optional dynamic keyword for dynamic typing

that's probably a much better approach than dynamic typing by default w/ optional static typing if you care about things like reading a program later

haskell has this too

Notorious b.s.d.
Jan 25, 2003

by Reene

Subjunctive posted:

if you write Hack in checked mode, you get a lot of that

optional typing devolves to no typing

it's cool that they will statically check the type data that no one will bother to use, i guess?

Notorious b.s.d.
Jan 25, 2003

by Reene

rrrrrrrrrrrt posted:

haskell has all those things :mrgw:

so does scala
..and f#
..and groovy
..and lots of other choices, to fit your personal tastes and project needs

good languages exist, let's use them

end the tyranny of p-langs

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Notorious b.s.d. posted:

optional typing devolves to no typing

it's cool that they will statically check the type data that no one will bother to use, i guess?

why does it devolve to no typing? if the file says it's checked then you have to provide type information (where it can't be inferred). you're going to go change the checking mode to avoid putting type info in your patch? feel bad for you, dude.

Notorious b.s.d.
Jan 25, 2003

by Reene

Shinku ABOOKEN posted:

this is why i was playing with kotlin

saying val todolist = ArrayList<Butt>() is much better than ArrayList<Butt> todolist = new ArrayList<Butt>()

this is really important
type inference doesn't exist to stop you from physically punching in more letters

it's not gonna gently caress up my day's productivity to type out "ArrayList<Butt> todolist = someMethod()" six times. it's going back to fix it later that breaks my balls

if the someMethod() return type changes later, in a world with type inference, i don't have to gently caress with anything as long as the program remains internally consistent. if something will be broken by the change, the compiler will tell me. if not, everything goes along as before.

type inference is having your cake and eating it too. dynamism and also correctness, without trade-offs.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:


def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That

Notorious b.s.d.
Jan 25, 2003

by Reene

fart simpson posted:

def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That

no worse than c++. and unlike c++, i don't find myself interacting with unreadable method signatures and stack traces.

sure, "map" has an ugly type manifest, but it's easy to use, and when errors arise a normal human being can read the stack trace.

(if you wanted to put your finger on something disgusting in scala, you should have pointed at the macro system. eurghhhh)

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Notorious b.s.d. posted:

no worse than c++

lol

Notorious b.s.d.
Jan 25, 2003

by Reene

Subjunctive posted:

why does it devolve to no typing? if the file says it's checked then you have to provide type information (where it can't be inferred). you're going to go change the checking mode to avoid putting type info in your patch? feel bad for you, dude.

ok so how many php libraries are available on hack in checked mode?

my guess would be "0"

it's cool that the language feature exists but i'm not going to get to port any php to it, because third parties aren't doing so

this is what happened to attempts at ruby type systems, too. and perl. perl has a sophisticated type system available but lol

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

scala seems alright i guess, but i dont see why you'd use it in a world where haskell and f# etc exist

comedyblissoption
Mar 15, 2006

quote:

no worse than c++. and unlike c++,
at least it isn't a programming language invented in north korea,

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

anyway im really liking rust's immutability by default. it's the first non functional programming language i've seen that does that, and it's v cool

CPColin
Sep 9, 2003

Big ol' smile.

Notorious b.s.d. posted:

this is really important
type inference doesn't exist to stop you from physically punching in more letters

it's not gonna gently caress up my day's productivity to type out "ArrayList<Butt> todolist = someMethod()" six times. it's going back to fix it later that breaks my balls

if the someMethod() return type changes later, in a world with type inference, i don't have to gently caress with anything as long as the program remains internally consistent. if something will be broken by the change, the compiler will tell me. if not, everything goes along as before.

type inference is having your cake and eating it too. dynamism and also correctness, without trade-offs.

Sounds like you should have used List instead of ArrayList when you declared your local variable!

comedyblissoption
Mar 15, 2006

an O(n) return type change is just the reasonable price you pay for being able to know your types later when you print out your source code

brap
Aug 23, 2004

Grimey Drawer

CPColin posted:

Sounds like you should have used List instead of ArrayList when you declared your local variable!

no, it's much better to be able to switch to any type in the universe than to be able to switch to another List implementation.

Mr. Glass
May 1, 2009

comedyblissoption posted:

an O(n) return type change is just the reasonable price you pay for being able to know your types later when you print out your source code

i'd love to know how you can do the equivalent refactoring in less than O(n) in any other language

JewKiller 3000
Nov 28, 2006

by Lowtax
ocaml is really good guys.

Notorious b.s.d.
Jan 25, 2003

by Reene

comedyblissoption posted:

even when a language has type inference for variable declarations, there will still be a camp that insists on not using it as a general rule
http://www.brad-smith.info/blog/archives/336

this guy is not all wrong

he says sometimes an explicit type declaration makes the code clearer. and, i guess, sometimes it does.

comedyblissoption
Mar 15, 2006

Mr. Glass posted:

i'd love to know how you can do the equivalent refactoring in less than O(n) in any other language

Notorious b.s.d. posted:

this is really important
type inference doesn't exist to stop you from physically punching in more letters

it's not gonna gently caress up my day's productivity to type out "ArrayList<Butt> todolist = someMethod()" six times. it's going back to fix it later that breaks my balls

if the someMethod() return type changes later, in a world with type inference, i don't have to gently caress with anything as long as the program remains internally consistent. if something will be broken by the change, the compiler will tell me. if not, everything goes along as before.

type inference is having your cake and eating it too. dynamism and also correctness, without trade-offs.

comedyblissoption
Mar 15, 2006

Notorious b.s.d. posted:

this guy is not all wrong

he says sometimes an explicit type declaration makes the code clearer. and, i guess, sometimes it does.
yeah but that's a strawman argument that no one who prefers large amounts of type inference is advocating

Notorious b.s.d.
Jan 25, 2003

by Reene

fart simpson posted:

scala seems alright i guess, but i dont see why you'd use it in a world where haskell and f# etc exist

the oo features of scala are really nice
also java interop

but nobody's making you use scala. there are lots of good languages. we live in a time of abundance.

it's not important to me whether you choose f# or scala, so long as you stop choosing python

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Mr. Glass posted:

i'd love to know how you can do the equivalent refactoring in less than O(n) in any other language

ignore incompatibilities until a user catches them run-time

O(n) by attrition, that's just as good as O(1), right?

Mr. Glass
May 1, 2009

oh lol i thought you were being sarcastic in the other direction

comedyblissoption
Mar 15, 2006

Mr. Glass posted:

oh lol i thought you were being sarcastic in the other direction
POES LAW

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax

Notorious b.s.d. posted:

it's not important to me whether you choose f# or scala, so long as you stop choosing python

can we talk about the problem of python and other dynamic languages in cs education? when i went to school we started with java and c, but now in an effort to be more broadly appealing i guess, a lot of intro cs sequences are using python. i'm not one of those assholes who thinks that if you can't learn pointer arithmetic you shouldn't be programming at all because you're not a REAL nerd... i understand that especially people from other majors may just want to pick up some python on the side, and they have no interest in being a "software engineer". but for cs majors i worry that neglecting static type systems early on, when students are developing programming habits that they'll carry on into the future, leads to confusion when types are introduced later, and you get people like tbc who just can't wrap their minds around how static typing could be useful. basically i feel about p-langs the same way dijkstra felt about basic... we risk poisoning the minds of a whole generation of future programmers (who we'll have to supervise)

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