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
Space Whale
Nov 6, 2014

Adbot
ADBOT LOVES YOU

JawnV6
Jul 4, 2004

So hot ...

comedyblissoption posted:

it's just that the community of developers have a much more different philosophy in structuring their programs

i think this message is getting lost in the epic tale of GMS versus The Stack

comedyblissoption
Mar 15, 2006

Space Whale posted:

It's always been natural for me to program with poo poo in -> some function -> output, and just set up chains of this.

code:
var whatever = someFunc();
somethingElse = someotherFunc(whatever);
foo = yetAnotherFunc(somethingElse); 
/*and so on*/ 
Hell, passing a reference to something a method mutates is kinda cringey to me on a level. I also hate out params with a passion.

Is this a big part of functional programming or just a particular coding style?
someone linked this from the proglang thread and I felt it captures the philosophy of trying to structure as much of your program as possible as simple input -> output

http://blog.jenkster.com/2015/12/what-is-functional-programming.html

unfortunately in c# there's literally no way for you to say a function doesn't mutate a mutable object reference that you pass in. the best you can do is to make the objects immutable, but c# makes this very verbose and a lot more difficult than f# or other langs to work w/.

comedyblissoption
Mar 15, 2006

JawnV6 posted:

i think this message is getting lost in the epic tale of GMS versus The Stack
yah the problem here though is that the GMS advocates are very clearly wrong

although usually people advocate for GMS through their code w/o realizing that they are doing so or that they are going to be causing a lot of complexity later

Space Whale
Nov 6, 2014

comedyblissoption posted:

someone linked this from the proglang thread and I felt it captures the philosophy of trying to structure as much of your program as possible as simple input -> output

http://blog.jenkster.com/2015/12/what-is-functional-programming.html

unfortunately in c# there's literally no way for you to say a function doesn't mutate a mutable object reference that you pass in. the best you can do is to make the objects immutable, but c# makes this very verbose and a lot more difficult than f# or other langs to work w/.

Honestly, I could (and do when I can) write JS (or whatever) that way. But there's no ENFORCEMENT.

... How hard would it be to make a keyword for a function and have some compiler enforcement?

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
the dude who uses emacs at work is like the least productive person we have I think

Bloody
Mar 3, 2013

JawnV6 posted:

not really

then I won't tell you what we're wasting millions of R&D dollars on lmao

comedyblissoption
Mar 15, 2006

Space Whale posted:

Honestly, I could (and do when I can) write JS (or whatever) that way. But there's no ENFORCEMENT.

... How hard would it be to make a keyword for a function and have some compiler enforcement?
from discussions about "pure" notations in Rust I've read (which Rust kind of had at one point in its prototype stage), it's not that simple to make it a usable part of a language unless you shed earthly concerns in a haskell-like manner

c++ kind of has this with constexpr (a notation for a function that can be resolved and evaluated at compile time) that they added ad hoc to the lang way late in the game and maybe that's kind of "good enough"? I don't really know

haskell is the only language I've played around w/ that has rigid enforcement against allowing you to gently caress with mutable global state arbitrarily w/o notating you are doing so (although i think theres an unsafeperformio hole, but you can restrict that with compiler flags)

rust will only let you if you put a big unsafe block around it

there's probably a bunch of esoteric langs that enforce this more obscure than haskell and rust

all the other languages I've seen rely on programmer discipline and convention (which usually means it's a free for all wild west)

Luigi Thirty
Apr 30, 2006

Emergency confection port.

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

Progressive JPEG
Feb 19, 2003

Notorious b.s.d. posted:

the type of that 5 is extremely important at every juncture. and not just its business context, but actual boring nuts and bolts poo poo

e.g. it's really loving serious to substitute a float for an integer

see also: all code that handles money

ive seen integer micros used to handle money

ie $1.25 = 1250000

worked p well actually

Space Whale
Nov 6, 2014

Can linters and static analysis at least get you part of the way there? Halting problem bla bla bla meh.

Space Whale
Nov 6, 2014

Progressive JPEG posted:

ive seen integer micros used to handle money

ie $1.25 = 1250000

worked p well actually

Literally doing number crunching with JavaScript right now and it's accurate enough (within so many decimals)

comedyblissoption
Mar 15, 2006

Space Whale posted:

Can linters and static analysis at least get you part of the way there? Halting problem bla bla bla meh.
using global mutable state is so baked into the common usage of how you program in all mainstream programming languages that i would be surprised if there's a linter that warns about it

idk much about static analysis. I'd imagine you could lint for certain obvious cases but not all.

Space Whale
Nov 6, 2014

comedyblissoption posted:

using global mutable state is so baked into the common usage of how you program in all mainstream programming languages that i would be surprised if there's a linter that warns about it

idk much about static analysis. I'd imagine you could lint for certain obvious cases but not all.

"Use the loving parameter list don't hard code globals you twit *flicks ASCII cig at you*"

hobbesmaster
Jan 28, 2008

Space Whale posted:

Literally doing number crunching with JavaScript right now and it's accurate enough (within so many decimals)

can you truly number crunch with JavaScript though? surely you would only be nibbling at best

Luigi Thirty
Apr 30, 2006

Emergency confection port.

hobbesmaster posted:

can you truly number crunch with JavaScript though? surely you would only be nibbling at best

well I remember that guy who embedded a JavaScript Bitcoin miner in his website that ran at like 40k hashes/sec

Notorious b.s.d.
Jan 25, 2003

by Reene

Progressive JPEG posted:

ive seen integer micros used to handle money

ie $1.25 = 1250000

worked p well actually
yes, this is how all math is done with money

all data at rest is in integers (cents, bps, micros, etc) and casting to/from float is explicit, so you don't make dumbfuck errors

Space Whale
Nov 6, 2014

hobbesmaster posted:

can you truly number crunch with JavaScript though? surely you would only be nibbling at best

Client side number crunching of metrics with ExtJS :kiddo:

hobbesmaster
Jan 28, 2008

use numpy at the least jesus

Space Whale
Nov 6, 2014

hobbesmaster posted:

use numpy at the least jesus

Well, more like "me and mine were brought in as consultants to fix this poo poo someone else did and $bigCorpThatFuckedUp is stuck with"

We're using WebAPI (C#) endpoints to serve the data to the browser.

hobbesmaster
Jan 28, 2008

ok, "because we were brought in and paid $texas/hr to fix it" is the one acceptable excuse to doing something stupid

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

comedyblissoption posted:

using global mutable state is so baked into the common usage of how you program in all mainstream programming languages that i would be surprised if there's a linter that warns about it

idk much about static analysis. I'd imagine you could lint for certain obvious cases but not all.

i remember being this angry about gms when i worked on a 40 person product but now that i work on a 4 person product I'm like jfc dude it's not that bad to deal with

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

LeftistMuslimObama posted:

i will post this every time spring is mentioned
http://java.metagno.me/

ComplexPortletApplicationContext.MyHandlerInterceptor1 is a real one? lol

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Notorious b.s.d. posted:

yes, this is how all math is done with money

all data at rest is in integers (cents, bps, micros, etc) and casting to/from float is explicit, so you don't make dumbfuck errors

64 bits is enough for anyone when your money is denominated in mills

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

fart simpson posted:

ComplexPortletApplicationContext.MyHandlerInterceptor1 is a real one? lol

youre triggering me

Space Whale
Nov 6, 2014

MALE SHOEGAZE posted:

i remember being this angry about gms when i worked on a 40 person product but now that i work on a 4 person product I'm like jfc dude it's not that bad to deal with

Do JS.

Now do JS with this.SomeGlobal (or this.SomeGlobal["somepropertylolfuckyou"]) everywhere instead of parameters being passed, ever, because it was written by assholes.

You'll get mad.

jony neuemonic
Nov 13, 2009

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?

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

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?

that's totally what I said yeah dipshit

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

fart simpson posted:

ComplexPortletApplicationContext.MyHandlerInterceptor1 is a real one? lol

ya. i rarely hit over .500 at this game, it's ridiculous. and just when you think "aha" it's the one-word answer that's right.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
for real

Only registered members can see post attachments!

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Space Whale posted:

Do JS.

Now do JS with this.SomeGlobal (or this.SomeGlobal["somepropertylolfuckyou"]) everywhere instead of parameters being passed, ever, because it was written by assholes.

You'll get mad.

if you have to call this.SomeGlobal, its not a global. it's a member of this. 'this' is an implicit argument, but an argument nonetheless. maybe I'm not following, but you seem to be complaining about instance state and not global state. i mean, still annoying.

JewKiller 3000
Nov 28, 2006

by Lowtax

Symbolic Butt posted:

that's totally what I said yeah dipshit

if the opinions you post are stupid enough then people will have a hard time distinguishing between you expressing yourself and a thoughtless retard going BUHHHHHHHHHHH

comedyblissoption
Mar 15, 2006

MALE SHOEGAZE posted:

i remember being this angry about gms when i worked on a 40 person product but now that i work on a 4 person product I'm like jfc dude it's not that bad to deal with
when people are creating new systems and creating this giant entangled web of global dependencies, they can understand it b/c theyre creating it and stuff

the issue is when someone doesnt have the benefit of this tower of complexity being created and having to understand it after the fact

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

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?

I'm not arguing that you need to write more code to make up the lack of static type checking, I'm arguing that your code WILL check the validity of the code anyway, be it with an unit test or an assert or an if else, maybe exceptions whatever.

the point is you'll do it anyway and this logic will implicitly check the trivial case of passing the wrong type

"oh but what I'm doing is not important enough for me to worry about validating data *pshaw*"

then why are you worried about static type checking on the first place

"oh but compile-time vs run-time--"

this is not even the original point, I won this.

"heh web developers amirite?"

shut up

skimothy milkerson
Nov 19, 2006

a few pages back but...

hobbesmaster posted:

python seems fine?

RELEASE THE SHAGGAR!!!

JewKiller 3000
Nov 28, 2006

by Lowtax
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

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Symbolic Butt posted:

I'm not arguing that you need to write more code to make up the lack of static type checking, I'm arguing that your code WILL check the validity of the code anyway, be it with an unit test or an assert or an if else, maybe exceptions whatever.

the point is you'll do it anyway and this logic will implicitly check the trivial case of passing the wrong type

"oh but what I'm doing is not important enough for me to worry about validating data *pshaw*"

then why are you worried about static type checking on the first place

"oh but compile-time vs run-time--"

this is not even the original point, I won this.

"heh web developers amirite?"

shut up

lol

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

JewKiller 3000 posted:

if the opinions you post are stupid enough then people will have a hard time distinguishing between you expressing yourself and a thoughtless retard going BUHHHHHHHHHHH

it bothers me because it's pretty much dogma for most people and there's so many weak sauce arguments. I was waiting someone to use that celsius/kelvin temperature example because yeah that's totally how everyone encodes numerical calculations in the real world.

like I'm not even saying that every language should be dynamically typed. I don't mind programming with either. the choice doesn't determine a flaw to the language like comedyblissoption said. it's just a shallow tradeoff, as worthy as the choice of tabs vs spaces

jony neuemonic
Nov 13, 2009

Symbolic Butt posted:

I'm not arguing that you need to write more code to make up the lack of static type checking, I'm arguing that your code WILL check the validity of the code anyway, be it with an unit test or an assert or an if else, maybe exceptions whatever.

the point is you'll do it anyway and this logic will implicitly check the trivial case of passing the wrong type

"oh but what I'm doing is not important enough for me to worry about validating data *pshaw*"

then why are you worried about static type checking on the first place

"oh but compile-time vs run-time--"

this is not even the original point, I won this.

"heh web developers amirite?"

shut up

nice meltdown lol.

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

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

  • Locked thread