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.
 
  • Locked thread
Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

fart simpson posted:

with static typeing you can encode temperature not as a float, but put the F, C, or K scale or whatever right in the type

you're dead motherfucker

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax

Symbolic Butt posted:

it's just a shallow tradeoff, as worthy as the choice of tabs vs spaces

horse



































poo poo

Weekend Bridges
Apr 8, 2015

by Smythe

jony neuemonic posted:

i know this is a whole page back but it blows me away every time someone argues that you don't need static typing if you just write more unit tests.

code is terrible why would you want to write and maintain more of it?

what blows me away is how java doesn't have unsigneds

JewKiller 3000
Nov 28, 2006

by Lowtax

Weekend Bridges posted:

what blows me away is how java doesn't have unsigneds

it was explicitly designed this way. the language authors thought programmers would be too retarded to get the signed/unsigned arithmetic correct. they're right, but it's still kinda poo poo i agree

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

JewKiller 3000 posted:

sorry mister butt but you haven't won anything and you're not going to because you're not on the winning side. the point is that static typing ALLOWS YOU TO EXPRESS AT COMPILE-TIME whether or not the validity has been checked, and so you can COMPLETELY ELIMINATE THE POSSIBLE EXISTENCE of code that requires validation running on a non-validated object. and your validation code can be, as you say, anything at all. this does not conflict one bit with the usefulness of static typing for your use case of "did i validate the thing", if anything you are just reinforcing the argument for static typing

oh I didn't claim I won the argument against my strawman on the compile-time vs runtime front. I feel like there's an interesting point in the "4 hours to run" case that someone mentioned itt

I was claiming victory over the fact that static type checking is a shallow way of proving correctness of your code. Everyone says it's actually important but then backpedals through some other orthogonal subject.

anyway this is the tradeoff for me, static type checking helps with those extreme cases I guess, it helps the compiler to make more performant machine code etc. but to me, against the cognitive overhead (even if it's small) and lack of expressiveness (a bit overrated sure) those advantages doesn't pay off.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
also I'm legit sorry for ruining another page with my posts itt lol

skimothy milkerson
Nov 19, 2006

Symbolic Butt posted:

also I'm legit sorry for ruining another page with my posts itt lol

dont sign

Shaman Linavi
Apr 3, 2012

i really like when i fat finger a variable name in python and the program just keeps running and returns garbage values like nothing ever happened

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
ok everyone go play the java spring game and post your favorite results. enough of this static typing touchbutt

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!

Symbolic Butt posted:

but to me, against the cognitive overhead (even if it's small) and lack of expressiveness (a bit overrated sure) those advantages doesn't pay off.

see, this is where i have a different perspective; it takes way less cognitive power for me to program in a statically typed language than it does to program in a dynamic one. i guess it's a person-by-person thing

JewKiller 3000
Nov 28, 2006

by Lowtax

Symbolic Butt posted:

but to me, against the cognitive overhead (even if it's small) and lack of expressiveness (a bit overrated sure) those advantages doesn't pay off.

i can't really respond to this without understanding more about what you mean by these terms. does cognitive overhead mean you have to think about what types your values have? because even in the most dynamic language ever, you need to do this, or you have no idea what code you can write to use those values. do you just not want to explicitly have to write those types down all the time? in that case the answer is type inference. what does lack of expressiveness mean? are you particularly attached to writing programs like "heheheh lemme just concatenate these two user input strings, treat the result as a variable name, and evaluate it in my current environment"? in that case you should stop that

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Shaman Linavi posted:

i really like when i fat finger a variable name in python and the program just keeps running and returns garbage values like nothing ever happened

a post by someone who actually never used python

even php raises a NOTICE for undefined variables


unless you mean you typoed into some other defined variable? but uh...


LeftistMuslimObama posted:

enough of this static typing touchbutt

alright alright

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
as a person who write in mumps every day, i think static typing is good. because i wish i had it. i cant even declare constants ffs.

JewKiller 3000
Nov 28, 2006

by Lowtax

Symbolic Butt posted:

a post by someone who actually never used python

a simple assignment will exhibit that behavior. have YOU ever used python?

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

JewKiller 3000 posted:

a simple assignment will exhibit that behavior. have YOU ever used python?

code:
>>> a = b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'b' is not defined
?

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

JewKiller 3000 posted:

i can't really respond to this without understanding more about what you mean by these terms. does cognitive overhead mean you have to think about what types your values have? because even in the most dynamic language ever, you need to do this, or you have no idea what code you can write to use those values. do you just not want to explicitly have to write those types down all the time? in that case the answer is type inference. what does lack of expressiveness mean? are you particularly attached to writing programs like "heheheh lemme just concatenate these two user input strings, treat the result as a variable name, and evaluate it in my current environment"? in that case you should stop that

i used to not think too much about the types of my values beforehand and also i thought stuff like weird runtime metaprogramming stuff was cool back when i used python a lot. i only changed my mind when i started using haskell more

Shaman Linavi
Apr 3, 2012

code:
def fact(n):
    dicks = 1
    for i in range(1,n):
        ducks = dicks * i
    return ducks
its me, the programmer regularly confusing ducks and dicks

Mao Zedong Thot
Oct 16, 2008


Oh look at all the terrible opinions itt

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

its simply impossible to prevent that kind of error

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Shaman Linavi posted:

code:
def fact(n):
    dicks = 1
    for i in range(1,n):
        ducks = dicks * i
    return ducks
its me, the programmer regularly confusing ducks and dicks

lol I swear I never thought of that

it's one of those syntax quirks that it's just wired in my brain for so long

Symbolic Butt fucked around with this message at 07:34 on Aug 13, 2016

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Mr Dog posted:

lol Java logging is such a fuckshow.

First there was Log4J
Then Sun added the very threadbare java.util.logging in Java 1.4
Then of course this is Java so we need a way to abstract between the two. Enter Commons Logging.
Then Java 1.5 came out with things like varargs, so the CL abstraction layer was replaced by the SLF4J abstraction layer
The abstraction layer needs at least one implementation, so enter Logback.

And that was the state of affairs for about 10-15 years. Oh and apparently JBoss and Jetty have their own internal metametaframeworks for switching among all this poo poo.

Now apparently Log4J is back in fashion? or at least they came out with a 2.0 version and its API is basically SLF4J except marginally better. Also there's a semi-decent systemd journal plugin for it.

Any sufficiently advanced Java is indistinguishable from parody.

then me: "our logging level is set to info, so i don't see these debug-level messages i have been putting in this class, how do i configure the logging level"

the answer is "gently caress you, spend a day trying to figure out which of the above things is the concrete implementation and then another day trying to figure out where the hell are you supposed to put the configuration file"

then we update our dependencies to new versions and make the project structure flatter. then you get to do it again because some magical thing inside the application autoconfigures the logging depending on what it can find in the classpath

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

fart simpson posted:

its simply impossible to prevent that kind of error

to be fair that problem has nothing to do with dynamic typing at all

there's plenty of dynamic languages that DON'T make the utterly retarded choice of using the exact same syntax for declaration and assignment

and in principle a static language could totally do that, though i don't know of any that actually does. visual basic has an optional compiler flag to disable explicit declarations, but i have it on good authority you are legally allowed to murder anybody who turns that on

There Will Be Penalty
May 18, 2002

Makes a great pet!

HoboMan posted:

Terrible Programmers: what font do you personally prefer to code in?

i hosed up my fonts by messing around and now i can't find one that don't suck





Jabor
Jul 16, 2010

#1 Loser at SpaceChem

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Soricidus posted:

the most appropriate font for your code is probably comic sans, op

annual reminder that one of my coworkers does this unironically (at about size 16pt typeface too)

VikingofRock
Aug 24, 2008





I like point-free style as long as you don't go too gung ho with it

BattleMaster
Aug 14, 2000


wait a minute, you can't fool me, this is just comic sans

MononcQc
May 29, 2007

NihilCredo posted:

to be fair that problem has nothing to do with dynamic typing at all

there's plenty of dynamic languages that DON'T make the utterly retarded choice of using the exact same syntax for declaration and assignment

yes! verifying for variable usage/declaration/reuse and their scope is entirely distinct from type checking. Unless you're using dynamic scoping, you could very well validate that stuff while compiling to whatever intermediary format the dynamic language may use, or through a linting phase with little trouble.

raminasi
Jan 25, 2005

a last drink with no ice

fart simpson posted:

with static typeing you can encode temperature not as a float, but put the F, C, or K scale or whatever right in the type

realtalk f# does this and it's useful as all hell

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Symbolic Butt posted:

heck the way some C# programmers write so many interfaces seems to me that deep down they're lusting for some sweet duck typing

people write one-concrete interfaces only because that's how you unit test in C#

I agree it's a flaw but not the way you think it is

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

VikingofRock posted:

I like point-free style as long as you don't go too gung ho with it

same here, in fact I actually stop short of point-free and just write code that's basically pointless

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

VikingofRock posted:

I like point-free style as long as you don't go too gung ho with it

guess what I use these utility functions for :yarg:

code:
let inline branch condition trueFunction falseFunction arg = 
    if condition then (trueFunction arg) else (falseFunction arg)

let inline branchBy predicate trueFunction falseFunction arg = 
    if (predicate arg) then (trueFunction arg) else (falseFunction arg)

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

Luigi Thirty posted:

i downloaded that 68k emulator/debugger easy68k to play with. it includes all kinds of simulated peripherals, serial connection, file i/o, even TCP and UDP networking. i decided i wanted to try clearing the 7-segment LEDs

code:
START:
    move.b #8, d0 ;clear 8-character LED
    move.l #$00E00000, a0
    
CLEARLCD:
    move.w #$0000, (a0)+ ;gently caress poo poo PISS	
    subq #1, d0
    cmp #0, d0
    bne CLEARLCD
:aaaaa: this instruction set is magic holy poo poo autoincrementing memory addresses

subq already sets the flags if you're operating on a data register, so no need for the cmp #0. you could also remove both subq+cmp and replace the branch with dbne d0,CLEARLCD.

auto inc/dec owns. that's why i like the 6809

Sweevo fucked around with this message at 16:09 on Aug 13, 2016

fritz
Jul 26, 2003

ive never done a spring and i got 1/10 on that quiz

Notorious b.s.d.
Jan 25, 2003

by Reene

Symbolic Butt posted:

I was claiming victory over the fact that static type checking is a shallow way of proving correctness of your code. Everyone says it's actually important but then backpedals through some other orthogonal subject.

it's as shallow or as deep as you want it to be. it's certainly possible to make the type system worthless, and just cast everything to Object the minute you get it. that's an option open to you. you can't fix stupid.

in the average case, static typing is a tool that even total numbskulls can use to avoid thousands of lovely edge cases without any special effort

in extreme cases, you can literally prove the correctness of a program before executing it

Notorious b.s.d.
Jan 25, 2003

by Reene

Luigi Thirty posted:

i downloaded that 68k emulator/debugger easy68k to play with. it includes all kinds of simulated peripherals, serial connection, file i/o, even TCP and UDP networking. i decided i wanted to try clearing the 7-segment LEDs

code:
START:
    move.b #8, d0 ;clear 8-character LED
    move.l #$00E00000, a0
    
CLEARLCD:
    move.w #$0000, (a0)+ ;gently caress poo poo PISS	
    subq #1, d0
    cmp #0, d0
    bne CLEARLCD
:aaaaa: this instruction set is magic holy poo poo autoincrementing memory addresses

i take it you have never used pdp-11 asm

aside from the type system itself, every feature of C is a pdp-11 asm feature. arrays, indexing, pre/post- inc/dec, pointers, pointers to pointers, a managed stack, etc

JawnV6
Jul 4, 2004

So hot ...

jony neuemonic posted:

i know this is a whole page back but it blows me away every time someone argues that you don't need static typing if you just write more unit tests.

code is terrible why would you want to write and maintain more of it?
now im wondering if this type system has enough gearing to check int Adder(int, int) is actually an adder without deigning to actually run the stupid function with an argument or two

maybe we're talking past around 'need' though

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

JawnV6 posted:

now im wondering if this type system has enough gearing to check int Adder(int, int) is actually an adder without deigning to actually run the stupid function with an argument or two

you can totally design a system that can statically prove that a given function is in fact an addition of some kind.

(which is to say, it's commutative and associative, and it has an identity element. floating-point need not apply.)

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Notorious b.s.d. posted:

i take it you have never used pdp-11 asm

aside from the type system itself, every feature of C is a pdp-11 asm feature. arrays, indexing, pre/post- inc/dec, pointers, pointers to pointers, a managed stack, etc

i have never owned a pdp-11 or used a pdp-11 emulator no


Sweevo posted:

subq already sets the flags if you're operating on a data register, so no need for the cmp #0. you could also remove both subq+cmp and replace the branch with dbne d0,CLEARLCD.

auto inc/dec owns. that's why i like the 6809

:gowron:

http://pastebin.com/k5anYEmm this poo poo is bananas you can explicitly set the data width in nearly every instruction! you can push/pop a range of registers onto the stack pointer in one instruction! holy poop this is way better than the x86 nightmare

Luigi Thirty fucked around with this message at 17:51 on Aug 13, 2016

Adbot
ADBOT LOVES YOU

JawnV6
Jul 4, 2004

So hot ...

Jabor posted:

you can totally design a system that can statically prove that a given function is in fact an addition of some kind.

(which is to say, it's commutative and associative, and it has an identity element. floating-point need not apply.)
sure, I'm not disagreeing with that

i'm sorta curious how you can have something that involved & clever about your specifics that is less code than a unit test or two, and if you're making a library you're probably writing an example client anyway, but yeah anyone who lowers themself to write a unit test is some kind of neaderthal coder barely worthy of derision

  • Locked thread