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
Nomnom Cookie
Aug 30, 2009



Subjunctive posted:

also yes agree, clone everything until the profiler tells you otherwise

I once argued that the value of this strategy pointed towards making cloning more automatic or lighter-weight in terms of syntax, but as with so many things it’s probably for the best that people don’t listen to me

how expensive is it to back this off once you figure out that allocating is expensive? my intuition here is informed by java where the idiomatic style is allocation intensive and once you learn that it’s hurting your p99 latency in production too much you’re just hosed and might as well rewrite (in rust)

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



oh or you can go full mechanical sympathy and write no-allocation from the start which is kinda like writing a ray tracer in logo (not a typo I do mean turtle graphics (turtle graphics owns I wonder if anyone has written it in rust yet (maybe I can put that on my github)))

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

you have to propagate references through the call chains, but I haven’t found it to be too bad. sometimes you have to make a change in some basic thing and then you chase the compiler through the consequences, but it’s more tedious than difficult, and doing the equivalent in C++ was guaranteeing that I would be staring at nightly-build crash reports for weeks

I do find that I write more small functions in Rust than I did in (pre-modern) C++, though, which provides more choke points for incrementally removing cloning

crazypenguin
Mar 9, 2005
nothing witty here, move along
rewriting aways excessive cloning in Rust is (relatively) easy once you're reasonably experienced with it.

it's a bit like nice type systems for more general changes. Ownership and borrowing means you can start making the change, then just spiderweb out through compiler errors to all the necessary consequences, then Everything Just Works once it compiles again.

the only really tricky part is there's a greater frequency of trying something and discovering it just won't work, and you have to try a different approach instead.

But it'd be pretty hard to have the same allocation rate problems as Java. Java suffers hard from a default assumption of heap allocation. Cloning in Rust isn't necessarily a new allocation at all.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Athas posted:

Doesn't matter, GHC has an extension for dynamic scoping.

Also, re all the above, programming in Haskell is a lot more like programming in mainstream languages than you'd expect.

lol of course it does

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Visions of Valerie posted:

go agda or go home

hell yeah and also I’m convinced Lean is gonna be the next big thing for type-touches

Zlodo
Nov 25, 2006

Subjunctive posted:

also yes agree, clone everything until the profiler tells you otherwise

and when the profiler does tell you otherwise, rewrite everything because you can't easily retrofit references into your code that was designed around copying everything

quote:

I once argued that the value of this strategy pointed towards making cloning more automatic or lighter-weight in terms of syntax, but as with so many things it’s probably for the best that people don’t listen to me

C++ does this and it's a terrible idea

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
sure you can, just wrap the problematic struct in an Rc<> and clone that around instead

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Zlodo posted:

and when the profiler does tell you otherwise, rewrite everything because you can't easily retrofit references into your code that was designed around copying everything
to me this is the main pitfall of rust, you can usually get away with cloning until you can't and it's not always obvious whether you've missed something trivial or whether the code is indeed something you can't change without doing a big rewrite

so you end up doing the rewrite and it turns out it was a trivial flawed assumption after all and now the rewrite also won't work and maybe you should just revert those changes but hang on, maybe you should

etc

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Visions of Valerie posted:

in other words, the problem is APL

exactly, which is why S-expressions are the superior syntax for a language

even “conveniences” like implicitly non-evaluated arguments suck, it’s better to have explicit quoting/unquoting/splicing constructs that work uniformly so everything looks and behaves like function application unless explicitly marked otherwise

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
sexpr languages make everything look syntactically like function application, but in practice programs are littered with special forms that semantically break the evaluation rule. i see it as a hideous false simplicity

logo and rebol have a similar structure to lisps, but replace eagerly evaluated sublists with lists that are always "quoted by default", resulting in a much more uniform evaluation rule. in logo especially lots of things that would need to be a macro in lisp can be written as an ordinary function

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
yeah that’s why I said I don’t like special forms, just make it all look and behave like function application, the cost of having special syntax for quote/quasiquote/splice is worth it if it’s the only special syntax you need

tef
May 30, 2004

-> some l-system crap ->
"different things should look different" tired, boring

"everything should look the same, because i read sicp once" incredible, awe inspiring

it's no wonder lisp did everything first, well, except popularity and adoption

tef
May 30, 2004

-> some l-system crap ->
lispers will tell you "code is data" and then write a long essay explaining that 9/11 wouldn't happen if planes were more like lisp, where code isn't data

Soricidus
Oct 21, 2010
freedom-hating statist shill

tef posted:

lispers will tell you "code is data" and then write a long essay explaining that 9/11 wouldn't happen if planes were more like lisp, where code isn't data

well obviously, it’d have been (/ 9 11)

tef
May 30, 2004

-> some l-system crap ->
https://paulgraham.com/hijack.html fwiw

Zlodo
Nov 25, 2006

lmao

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:


ive been saying this

chatt
Aug 16, 2003

Oven Wrangler
Hijacking a plane by buying 257 tickets

Athas
Aug 6, 2007

fuck that joker
Only a programmer deeply versed in the risks and mitigations of buffer overflows could device the idea of locking the cockpit door.

Voodoo Cafe
Jul 19, 2004
"You got, uhh, Holden Caulfield in there, man?"

Soricidus posted:

well obviously, it’d have been (/ 9 11)

lol

raminasi
Jan 25, 2005

a last drink with no ice

MononcQc posted:

Go: just write the loving code my dude, ship a feature. What we really want is a fast toolchain and no way to let anyone get too fancy, and fix the problems with architecture and process

i have been learning about this firsthand over the last nine months and sometimes it feels like it's too easy to just write the code. i know the language isn't responsible for a deficit of architectural vision and planning but it sure feels like it's an enabler sometimes.

door 1: sit down and think hard about the application's concurrency requirements now and in the future

door 2: just add more goroutines lol

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

obviously there are places for special forms (what are you going to do, lift each branch of an ite into a lambda to defer its evaluation??) but like operator overloading the real crime is when the language lets programmers define their own evaluation semantics

looking at you, scala

Plorkyeran
Mar 22, 2007

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

raminasi posted:

i have been learning about this firsthand over the last nine months and sometimes it feels like it's too easy to just write the code. i know the language isn't responsible for a deficit of architectural vision and planning but it sure feels like it's an enabler sometimes.

door 1: sit down and think hard about the application's concurrency requirements now and in the future

door 2: just add more goroutines lol

when writing go you are required to just type continuously until your program is complete and working. pausing to ever think about design or abstractions is a sin against pike.

Sapozhnik
Jan 2, 2005

Nap Ghost
question mark exclamation point question mark exclamation point, except it's if err not equal nil return nil comma err

Nomnom Cookie
Aug 30, 2009



Dijkstracula posted:

obviously there are places for special forms (what are you going to do, lift each branch of an ite into a lambda to defer its evaluation??) but like operator overloading the real crime is when the language lets programmers define their own evaluation semantics

looking at you, scala

operator overloading is fine the real real crime is people who disagree with me. and unary -

Zlodo
Nov 25, 2006
what's wrong with unary -

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
seperating the negation/subtraction symbol and negative numeric literals into - and _ is one of the very few things I think J syntax gets right

Nomnom Cookie
Aug 30, 2009



Zlodo posted:

what's wrong with unary -

it’s rarely used and makes the semantics of - context-dependent

Soricidus
Oct 21, 2010
freedom-hating statist shill
unary - is fine. it’s unary + that has no reason to exist

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
in js, unary + is very useful: "coerce to number"

abraham linksys
Sep 6, 2010

:darksouls:

Plorkyeran posted:

when writing go you are required to just type continuously until your program is complete and working. pausing to ever think about design or abstractions is a sin against pike.

you'd think that go popularized microservices due its low process overhead compared to other languages, but it's actually because go is the only language where your code is written in the exact same way if you have 1 endpoint or 100 in your codebase

Nomnom Cookie
Aug 30, 2009



Soricidus posted:

unary - is fine. it’s unary + that has no reason to exist

much like…your posts!!!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

the great thing about go is that everyone says “just use goroutines and channels and you don’t have to worry about data races” but then they start profiling and look at the dispatch costs for that big piece of data and say “well, let’s just put a lock in this struct that you have to take and we’ll put a big comment here”. and it works OK! the load graphs drop a bit and get screenshotted into promo packets

then someone mistypes “RWLock” and “RLock”—or they misunderstand closure rules—and you have a silent race and then you’re chasing thousands of data races in just your test suite

tef
May 30, 2004

-> some l-system crap ->

Subjunctive posted:

then someone mistypes “RWLock” and “RLock”—or they misunderstand closure rules—and you have a silent race and then you’re chasing thousands of data races in just your test suite

this is a really good blog post

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
lol mutex is a copyable value type

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum
that go code is so hard to read, constant arrows and syntax im dying and the word go everywhere

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

rjmccall posted:

lol mutex is a copyable value type

does go have uncopyable types?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
no, definitely not. but it's extremely go-ish to be like "well we certainly don't want to have to reference-allocate a mutex" and completely ignore the pitfalls of that decision given that the language can't express any of the restrictions that would make value mutexes sane. "it's fine, this is how it works in c and people can handle it"

i wonder what happens if you copy a locked mutex

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

tef posted:

this is a really good blog post

the sigplan paper is great too

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