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
Workaday Wizard
Oct 23, 2009

by Pragmatica

FamDav posted:

uh so you have stack objects which live on the stack

then you have managed pointers which are just reference counted. these are local to a task and when copied are just pointer copies.

then you have owned pointers. the difference is these are always deep copied if you want em and they live in the heap that all tasks can access.

borrowed pointers are always shallow copy operations, and its a normal pointer that the compiler checks for certain things. if you are borrowing a managed pointer, the compiler automatically adds a sentinel managed pointer when necessary so that the memory isnt gced. thats pretty simple.

if you are borrowing an owned pointer, the compiler insures that the owned pointer is not being moved or reassigned while the borrowed pointers are in scope. this last bit is important because the memory associated with an owned pointer is freed under reassignment or going out of scope.

rust also allows you to attach a specific lifetime to a borrowed pointer, which is p cool

thanks for the info but i still don't undersatnd lifetimes

are they physical things that exist in the final binaries (exe files) or are they concepts that exist only during compilation?

i couldn't get rust to work on windows out of the box and i don't have too much free time to check on linux so i have no idea

PS: if any rust developers read this please for gods sake make a windows package that works. stop targeting linux. that poo poo is for webdev startups and they already have rubynode.js

Adbot
ADBOT LOVES YOU

FamDav
Mar 29, 2008

Shinku ABOOKEN posted:

thanks for the info but i still don't undersatnd lifetimes

are they physical things that exist in the final binaries (exe files) or are they concepts that exist only during compilation?

i couldn't get rust to work on windows out of the box and i don't have too much free time to check on linux so i have no idea

PS: if any rust developers read this please for gods sake make a windows package that works. stop targeting linux. that poo poo is for webdev startups and they already have rubynode.js

the lifetime of a variable is used to figure out where in the code to destroy it. borrowed pointers are an attempt to attach a lifetime to a c-style pointer.

Nomnom Cookie
Aug 30, 2009



FamDav posted:

uh so you have stack objects which live on the stack

then you have managed pointers which are just reference counted. these are local to a task and when copied are just pointer copies.

then you have owned pointers. the difference is these are always deep copied if you want em and they live in the heap that all tasks can access.

borrowed pointers are always shallow copy operations, and its a normal pointer that the compiler checks for certain things. if you are borrowing a managed pointer, the compiler automatically adds a sentinel managed pointer when necessary so that the memory isnt gced. thats pretty simple.

if you are borrowing an owned pointer, the compiler insures that the owned pointer is not being moved or reassigned while the borrowed pointers are in scope. this last bit is important because the memory associated with an owned pointer is freed under reassignment or going out of scope.

rust also allows you to attach a specific lifetime to a borrowed pointer, which is p cool

this is some bullshit. but maybe they'll come up with something worth stealing for a good language

minidracula
Dec 22, 2007

boo woo boo

Nomnom Cookie posted:

this is some bullshit. but maybe they'll come up with something worth stealing for a good language
Since it's Rustchat Q&A, can anyone tell me why they dropped typestates?

I don't really care, as I don't use Rust ATM, but I am curious.

Also seconding whoever it was that pleaded for a working Windows build/installer for all the right reasons (ITT or wherever I read it).

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

in other news lisp was designed with an algol/fortran like syntax, but they started using s-expressions and got used to them

this is correct

tef posted:

lisp's head and tail are ibm assembler instructions, but they got used to them, because they could write caddadddadaadar

this is also correct, but i would like to add that anyone who honestly prefers car/cdr to head/tail needs to stop programming IMMEDIATELY

this applies doubly so if the reason you like car/cdr is the ability to write caddadadadr

JewKiller 3000
Nov 28, 2006

by Lowtax

FamDav posted:

then you have managed pointers which are just reference counted.

lol what a complete waste of time.

weird
Jun 4, 2012

by zen death robot
first and rest are for when youre treating conses as lists, car and cdr are for when youre treating conses as cons cells

JewKiller 3000
Nov 28, 2006

by Lowtax
car and cdr are for when you're on a machine where "contents of address register" and "contents of decrement register" mean something

you're not

they don't

stop using them

weird
Jun 4, 2012

by zen death robot
whats a better name for the first/second part of a cons

JewKiller 3000
Nov 28, 2006

by Lowtax
i mean jesus christ if i was an anti-lisp fanatic (and i'm not), i could not come up with a better reason why lisp embraces useless obscurity than car/cdr

JewKiller 3000
Nov 28, 2006

by Lowtax
the better name is head and tail as i've already described, that's literally what a cons is

JewKiller 3000
Nov 28, 2006

by Lowtax
for clarification: lists ARE nothing more than cons cells, the only reason you see a difference in this treatment is that you're used to writing useless cacddadadadadccadadadarr bullshit

Notorious b.s.d.
Jan 25, 2003

by Reene

JewKiller 3000 posted:

the better name is head and tail as i've already described, that's literally what a cons is

ok so you have a headttttdtddddtail function then

JewKiller 3000
Nov 28, 2006

by Lowtax
no i don't and you shouldn't either human being. write your programs so they're readable, not to minimize the amount of characters you have to type, jesus christ do your loving job, they probably pay you enough.

JewKiller 3000
Nov 28, 2006

by Lowtax
anyway, lisp is a neat idea that has influenced a lot of important poo poo, but without static types a la typed racket, it's a toy. also the main argument for lisp is macros, and those are almost impossible to write correctly. trace through macroexpand until you want to kill yourself. or just use a language with syntax

weird
Jun 4, 2012

by zen death robot
lists are one thing you can build with cons cells. (cons 1 2) isn't a list. write programs so that theyre readable, don't mix abstraction levels and use list terminology for the underlying mechanism

JewKiller 3000
Nov 28, 2006

by Lowtax
i'm coming from the perspective that (cons 1 2) has type int list. if you're not then sorry about your broken mental model.

also i think it should be more like cons 1 [2] but i'm an ML programmer so

weird
Jun 4, 2012

by zen death robot
http://docs.racket-lang.org/guide/pairs.html

JewKiller 3000
Nov 28, 2006

by Lowtax
oh so you consider all pairs to be cons cells? very well, then you want fst and snd, not car and cdr

JewKiller 3000
Nov 28, 2006

by Lowtax
because we speak english, not loving ibm 704 assembly

weird
Jun 4, 2012

by zen death robot
fst and snd are okay names

JewKiller 3000
Nov 28, 2006

by Lowtax
i actually didn't know that cons was used for pairs in general in lisp. in ML-land the :: operator is pronounced cons, as in 1 :: [2], and it only works for lists. hence my confusion :)

ML has more syntax, so for a general pair you'd write something like (1, "foo")

Notorious b.s.d.
Jan 25, 2003

by Reene

JewKiller 3000 posted:

i actually didn't know that cons was used for pairs in general in lisp. in ML-land the :: operator is pronounced cons, as in 1 :: [2], and it only works for lists. hence my confusion :)

ML has more syntax, so for a general pair you'd write something like (1, "foo")

Common Lisp also has static typing

I assume your only contact with "lisp" is scheme or elisp because you are wrong about everything

minidracula
Dec 22, 2007

boo woo boo

JewKiller 3000 posted:

i'm coming from the perspective that (cons 1 2) has type int list. if you're not then sorry about your broken mental model.

also i think it should be more like cons 1 [2] but i'm an ML programmer so
Hey what's up ML buddy. I like ML lots too, even though I'm still a die-hard Lisp slob; I guess I got religion late in life (PS: I didn't get much religion though). You can ease up on the bad Lisp programming hate though; I'm pretty sure no-one ITT actually writes Lisp that way.

(For realz though: for the longest time I never thought I'd be one of those people who cared real hard about type systems, and I wasn't; then one day I looked into my heart and found Pierce and it's been nothing but the Good News since).

JewKiller 3000
Nov 28, 2006

by Lowtax
common lisp has everything and nobody uses any of it

weird
Jun 4, 2012

by zen death robot
also gently caress you if youre writing car/cdr combinations with any regularity outside of the definition of a function that describes what you're trying to extract

weird
Jun 4, 2012

by zen death robot
regardless of the name you use for car and cdr

minidracula
Dec 22, 2007

boo woo boo

JewKiller 3000 posted:

anyway, lisp is a neat idea that has influenced a lot of important poo poo, but without static types a la typed racket, it's a toy. also the main argument for lisp is macros, and those are almost impossible to write correctly. trace through macroexpand until you want to kill yourself. or just use a language with syntax
I'd just like to say for the record that you can have my macroexpand-1 (and unwind-protect (and call/cc in Scheme)) when you pry it from my cold dead hands. :colbert:

JewKiller 3000
Nov 28, 2006

by Lowtax

mnd posted:

Hey what's up ML buddy. I like ML lots too, even though I'm still a die-hard Lisp slob; I guess I got religion late in life (PS: I didn't get much religion though). You can ease up on the bad Lisp programming hate though; I'm pretty sure no-one ITT actually writes Lisp that way.

(For realz though: for the longest time I never thought I'd be one of those people who cared real hard about type systems, and I wasn't; then one day I looked into my heart and found Pierce and it's been nothing but the Good News since).

if you haven't already, buy both of pierce's books. he's a loving genius, i can't even. i'm totally not on the level of people who care Real Hard, because those people have moved on to coq and agda. but ML is a sweet spot for me. it lets me express the types i want without having to prove any theorems

i also like robert harper at cmu, he makes some excellent blog posts under the name "existential type" that advocate for the ML way of thinking

JewKiller 3000
Nov 28, 2006

by Lowtax

mnd posted:

I'd just like to say for the record that you can have my macroexpand-1 (and unwind-protect (and call/cc in Scheme)) when you pry it from my cold dead hands. :colbert:

i am not qualified to argue about call/cc but oleg kiselyov certainly is: http://okmij.org/ftp/continuations/against-callcc.html

double sulk
Jul 2, 2010

all lisps are garbage

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
garbage collecting, you mean

minidracula
Dec 22, 2007

boo woo boo

JewKiller 3000 posted:

if you haven't already, buy both of pierce's books. he's a loving genius, i can't even. i'm totally not on the level of people who care Real Hard, because those people have moved on to coq and agda. but ML is a sweet spot for me. it lets me express the types i want without having to prove any theorems

i also like robert harper at cmu, he makes some excellent blog posts under the name "existential type" that advocate for the ML way of thinking
Yeah, I have both of Pierce's tomes. And I've moved on to Coq (but not Agda yet... still moves too fast for me, too experimental, Haskell still hasn't owned me body and soul yet, and no tactics yet).

ML is still the shiz though. Real talk: Standard ML or OCaml? I kinda swing both ways, but I'm still relatively green with OCaml compared to SML (unless you count F#, which I sorta do... but still). I've stopped fighting against the OCaml tide a bit, but I haven't given up on SML either.

Bob Harper is the man, have you seen his new book? It's pretty boss. You can still get a "draft" PDF for free off his site. I giggled the other day when I noticed this "draft" PDF had been revised this June with errata and updates post-release.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
i believe in you sulk. i am sure you were just pointing a property of all lisp runtimes and just forgot to finish your sentence.

double sulk
Jul 2, 2010

Suspicious Dish posted:

i believe in you sulk. i am sure you were just pointing a property of all lisp runtimes and just forgot to finish your sentence.

yeh the rest of it was collected before it could even be finished

minidracula
Dec 22, 2007

boo woo boo

JewKiller 3000 posted:

i am not qualified to argue about call/cc but oleg kiselyov certainly is: http://okmij.org/ftp/continuations/against-callcc.html
Yeah, Oleg is one of my icons; I aspire to be like Oleg someday. His arguments against call/cc are compelling. I was just rereading his article against call/cc as a primitive the other day, but I'm not entirely sold yet.

I do like his delimited continuations implementation for OCaml though, have been tinkering and futzing with that some.

Oleg isn't the first to argue against call/cc as a primitive; Felleisen has raised the issue in the past before as well.

JewKiller 3000
Nov 28, 2006

by Lowtax

mnd posted:

Yeah, I have both of Pierce's tomes. And I've moved on to Coq (but not Agda yet... still moves too fast for me, too experimental, Haskell still hasn't owned me body and soul yet, and no tactics yet).

ML is still the shiz though. Real talk: Standard ML or OCaml? I kinda swing both ways, but I'm still relatively green with OCaml compared to SML (unless you count F#, which I sorta do... but still). I've stopped fighting against the OCaml tide a bit, but I haven't given up on SML either.

Bob Harper is the man, have you seen his new book? It's pretty boss. You can still get a "draft" PDF for free off his site. I giggled the other day when I noticed this "draft" PDF had been revised this June with errata and updates post-release.

the folks i know also use coq. i tried, but i'm not very good, it's too hard. coq is hard. hard coq.

i use ocaml, but sml is close enough that i could switch if i needed to, and you probably could too! use of ocaml's object system is not very common, especially in library interfaces. there's a bit to learn with the module system i suppose, but otherwise it's just minor syntax differences, and dealing with the absence of eqtypes (god i wish ocaml had haskell-style type classes)

i haven't checked out harper's latest book yet, but i will now, thanks! :)

Opinion Haver
Apr 9, 2007

there's a post somewhere about how lisp's flexibility is ultimately its downfall and how any sufficiently complicated lisp will implement 80% of haskell except different lisps will implement a different 80% with differing quality

JewKiller 3000
Nov 28, 2006

by Lowtax
but people also say that any sufficiently complex program will reimplement (badly) 80% of common lisp

so if we have 80% of lisp and lisp is 80% of 80% quality then what do we have??? dicks

Adbot
ADBOT LOVES YOU

unixbeard
Dec 29, 2004

how many people here use ocaml professionally and dont work at jane st

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