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
Arcsech
Aug 5, 2008

pram posted:

its actually the best

actually a language designed in the last 10 years that has a static type system but not generics is garbage hth

Adbot
ADBOT LOVES YOU

brap
Aug 23, 2004

Grimey Drawer
every time i think about it i am blown away by how loving stupid the decision to not have generics is

even java type erasure generics are pretty helpful

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

what could possibly have been the motivation to omit generics? they're like the least-controversially-useful thing you can have in a modern language.

pram
Jun 10, 2001

Arcsech posted:

actually a language designed in the last 10 years that has a static type system but not generics is garbage hth

actually rob pike is way. way smarter than you and probably has a bigger dick. ya mad?

pram
Jun 10, 2001
the smartest engineers didnt include generics :qq: durrrr cry cry *wipes tears with copy of learn you some erlang*

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i just cut myself on pram's goposting

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

pram posted:

actually rob pike is way. way smarter than you and probably has a bigger dick. ya mad?

Rob's smart, but it's not like he redefines the category. he had a lot of latitude on p9 and so he got to flex all over, but it's not clear that he's really that connected to the realities of industrial software development. go seems like a language designed for "software development as experienced by Rob Pike", but not necessarily one that generalizes to "software development as experienced by anyone who actually has constraints".

JewKiller 3000
Nov 28, 2006

by Lowtax

Arcsech posted:

actually a language designed in the last 10 years that has a static type system but not generics is garbage hth

another right opinion itt

pram
Jun 10, 2001

Subjunctive posted:

Rob's smart, but it's not like he redefines the category. he had a lot of latitude on p9 and so he got to flex all over, but it's not clear that he's really that connected to the realities of industrial software development. go seems like a language designed for "software development as experienced by Rob Pike", but not necessarily one that generalizes to "software development as experienced by anyone who actually has constraints".

thank you for your opinion but i dont get that last part. its a simple procedural language, its really good and easy for web and unix stuff. rob pike is a unix/p9 guy and google is a web company.. makes sense to me

pram
Jun 10, 2001
coincidentally my deployment environment is unix and my end users are using http

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
after spending 90% of my time in java trying to fight with compilation issues and fighting with intellij i can understand a lot of the motivations behind go

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
intellij is so loving bad

pram
Jun 10, 2001
deploying your go source with a docker onbuild container is so loving sweet. u dont even know man. straight from git to prod

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
yeah it's really cool

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
docker compose sucks tho

pram
Jun 10, 2001
use fleet lol

leftist heap
Feb 28, 2013

Fun Shoe

MALE SHOEGAZE posted:

intellij is so loving bad

nah. maybe you are bad, hmm?

pram
Jun 10, 2001
maybe programming doesnt have to be masochistic? maybe haskell and erlang and scala are actually pointless poo poo? and go is the best? some food for thought

triple sulk
Sep 17, 2014



erlang is actually useful in some specific cases unlike haskell or scala

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

pram posted:

maybe programming doesnt have to be masochistic? maybe haskell and erlang and scala are actually pointless poo poo? and go is the best? some food for thought

code:
go 
	// would be nice if we could combine these somehow....
	// oh well
	func multiply_float(Float f, Float g)
		return f * g
	cnuf 

	func multiply_int(Int i, Int o)
		return i * o
	cnuf
og

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
channels / go routines are really cool though

pram
Jun 10, 2001

MALE SHOEGAZE posted:

code:
go 
	// would be nice if we could combine these somehow....
	// oh well
	func multiply_float(Float f, Float g)
		return f * g
	cnuf 

	func multiply_int(Int i, Int o)
		return i * o
	cnuf
og

there are a lot of ways to do this. reflect, switch. lol. i will admit int,uint,float are a pain in the rear end but it isnt impossible. for example just casting from an interface (i didnt put much thought into this)

http://play.golang.org/p/ySev-ZSQC6

code:
package main

import "fmt"

func main() {

	fmt.Println(Multiply(5, 2.3).(float64))
}

func Multiply(first, second interface{}) (answer interface{}) {

	var f, s float64
	var fi, si int

	f, ok := first.(float64)
	if !ok {
		fi = first.(int)
		f = float64(fi)
	}

	s, ok = second.(float64)
	if !ok {
		si = second.(int)
		s = float64(si)
	}

	return f * s

}

brap
Aug 23, 2004

Grimey Drawer
I'm highly amused that you are defending that code and not mocking the poo poo out of it

pram
Jun 10, 2001
glad i can bring a little joy into yr life

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

pram posted:

there are a lot of ways to do this. reflect, switch. lol. i will admit int,uint,float are a pain in the rear end but it isnt impossible. for example just casting from an interface (i didnt put much thought into this)

http://play.golang.org/p/ySev-ZSQC6

code:
package main

import "fmt"

func main() {

	fmt.Println(Multiply(5, 2.3).(float64))
}

func Multiply(first, second interface{}) (answer interface{}) {

	var f, s float64
	var fi, si int

	f, ok := first.(float64)
	if !ok {
		fi = first.(int)
		f = float64(fi)
	}

	s, ok = second.(float64)
	if !ok {
		si = second.(int)
		s = float64(si)
	}

	return f * s

}

i'm the total lack of compile time type safety:

http://play.golang.org/p/ywG69MjjlV

pram
Jun 10, 2001
what do you expect, theyre strings going into an interface. write a test

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

pram posted:

there are a lot of ways to do this. reflect, switch. lol. i will admit int,uint,float are a pain in the rear end but it isnt impossible. for example just casting from an interface (i didnt put much thought into this)

http://play.golang.org/p/ySev-ZSQC6

code:
package main

import "fmt"

func main() {

	fmt.Println(Multiply(5, 2.3).(float64))
}

func Multiply(first, second interface{}) (answer interface{}) {

	var f, s float64
	var fi, si int

	f, ok := first.(float64)
	if !ok {
		fi = first.(int)
		f = float64(fi)
	}

	s, ok = second.(float64)
	if !ok {
		si = second.(int)
		s = float64(si)
	}

	return f * s

}

this post convinced me to learn go

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

pram posted:

what do you expect, theyre strings going into an interface. write a test



i expect my language to offer type safe ways to express generic functionality, as opposed to totally untypesafe ways

VikingofRock
Aug 24, 2008




I dunno pram, I'm not really sure that's better than

C++ code:
#include <iostream>

template <typename A, typename B>
auto multiply(A a, B b) {
    return a*b;
}

int main()
{
   std::cout << multiply(5, 2.3) << std::endl; 
}
or

code:
main = do
    let a = multiply 4294967296 4294967296
        b = multiply 5 2.3
    putStrLn $ show a
    putStrLn $ show b

multiply :: Num a => a -> a -> a
multiply = (*)

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

VikingofRock posted:

I dunno pram, I'm not really sure that's better than

C++ code:
#include <iostream>

template <typename A, typename B>
auto multiply(A a, B b) {
    return a*b;
}

int main()
{
   std::cout << multiply(5, 2.3) << std::endl; 
}
or

code:
main = do
    let a = multiply 4294967296 4294967296
        b = multiply 5 2.3
    putStrLn $ show a
    putStrLn $ show b

multiply :: Num a => a -> a -> a
multiply = (*)

yeah but where are your unit tests???

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i mean if there was even just like, multiple dispatch

http://play.golang.org/p/gCslvwjdLp

but nope lol!!

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
no the best solution is to pass around empty interfaces and then reflect on things as if you were writing ruby

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
gos types system is like the worst type system i've ever seen

abraham linksys
Sep 6, 2010

:darksouls:

MALE SHOEGAZE posted:

docker compose sucks tho

i use docker compose (actually we're still on fig) at work :smith:

pram
Jun 10, 2001

MALE SHOEGAZE posted:

i expect my language to offer type safe ways to express generic functionality, as opposed to totally untypesafe ways

its type safe if you execute it :grin:

pram
Jun 10, 2001
i will relent. other languages may very well be better suited for multiplying numbers

pram
Jun 10, 2001
but heres the thing: that c++ program took 12 hours to compile and has a bunch of dynamically linked library dependencies. suck it nerds

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

pram posted:

but heres the thing: that c++ program took 12 hours to compile and has a bunch of dynamically linked library dependencies. suck it nerds

2008 called etc

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
go compiles quickly because it doesn't have to link to any libraries because no one has written any useful libraries for go

Adbot
ADBOT LOVES YOU

pram
Jun 10, 2001
there are actually a lot. ive been using this one lately

https://github.com/koding/kite

also bash doesnt do floating point, what a piece of poo poo

expr 2.3 \* 3
expr: not a decimal number: '2.3'

  • Locked thread