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
gonadic io
Feb 16, 2011

>>=

Bloody posted:

idk what i'd use rust for. everything systemsy i do eventually boils down into some nasty unsafe poo poo which presumably (?) would wind up infecting everything and everything else is probably more pleasant to do in c# or similar

i'm using it for ray casting. i think i might be better off just throwing that poo poo to a compute shader though tbh

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

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

Slurps Mad Rips posted:

the nice thing is that you'll rarely need it so most people dont need to use it unless they're writing data structures that have a structure that stores a const object.
and using placement new to mutate that const object

triple sulk
Sep 17, 2014



imo rust is never going to take off. people who know c/c++ and already have their knowledge base and the bazillion resources available to them will stick with it and for anything else you'd probably just use java/c#/js since it's most likely webdev. it doesn't help that it's also syntactically ugly as poo poo.

this isn't a critique of it as a language but the space seems pretty jammed up right now and i really don't get what point it serves, especially when the stdlib is small as hell and doesn't give you much of anything to work with.

Shaggar
Apr 26, 2006
its the same as every other p-lang. its goal is to not be java or c#, so by definition it cannot be good.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
if rust is a plang then that word has lost all meaning.

i think it's actually in a decent position to take off, not to say that it's guaranteed to. it's aimed at a niche that very few languages are. currently that niche is filled by c/c++, and their age is showing a lot. c++ is so byzantine that no one really understands it. i get the sense that people are fed up with the complexity and undefined behavior that comes with it, and at this point the demands of backwards compatibility make it impossible to "fix". better to have a new language designed in this century without that baggage.

angry_keebler
Jul 16, 2006

In His presence the mountains quake and the hills melt away; the earth trembles and its people are destroyed. Who can stand before His fierce anger?

HappyHippo posted:

if rust is a plang then that word has lost all meaning

actually it's a pee lang, because you should just flush it down the toilet

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Shaggar posted:

its the same as every other p-lang. its goal is to not be java or c#, so by definition it cannot be good.
i bet you'd still be programming in delphi if it were supported

Shaggar
Apr 26, 2006
ive never used Delphi but it sounds like it was probably pretty good for its time.

Vanadium
Jan 8, 2005

Yeah + there's no shortage of people who decry that it went away with no true replacement

cowboy beepboop
Feb 24, 2001

Bloody posted:

idk what i'd use rust for. everything systemsy i do eventually boils down into some nasty unsafe poo poo which presumably (?) would wind up infecting everything and everything else is probably more pleasant to do in c# or similar

the idea is the nasty unsafe poo poo gets put in a few places behind 'unsafe' blocks where you can stare at them until you're sure you're not stomping all over your memory and the rest of your program is properly checked by the compiler
also it's a lot nicer to write than c. c is so ugly.

leftist heap
Feb 28, 2013

Fun Shoe
i want to gently caress and cum in java

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
better make sure your license for that is up to date. i hear larry's cracking down on that these days

Dr Monkeysee
Oct 11, 2002

just a fox like a hundred thousand others
Nap Ghost
i dunno i agree with everybody who isn't quite sure what niche rust fills. if you need a systems language you likely need the level of control that c gives you so you immediately toss out all the niceties rust gives you in order to accomplish that or you just... use c.

but maybe i'm just a grumpy old programmer. none of the languages invented in the last 10 years or so have held any appeal to me. also i like c (i do not much like c++).

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

redleader posted:

you also forgot erlang!

erlang is great, currently influencing a upcoming distributed systems project into using it.

well OTP is great. I'm not that into the whole multiple punctuation for similar things thing. but I haven't looked at the new hipster erlang enough to know if it's good.

MononcQc
May 29, 2007

On the Erlang VM, Alpaca is the current hipste

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!

leper khan posted:

but I haven't looked at the new hipster erlang enough to know if it's good.

elixir is pretty good. i feel like half the syntax changes it made were for the better, and the other half are stupid. mix is nice.

MononcQc posted:

On the Erlang VM, Alpaca is the current hipste

I was about to make a joke about needing a third OTP language, so welp

more like dICK
Feb 15, 2010

This is inevitable.

Gazpacho posted:

i bet you'd still be programming in delphi if it were supported

I still use FreePascal

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

MononcQc posted:

On the Erlang VM, Alpaca is the current hipste

wow I'm out of the loop, I thought it was still phoenix/elixir.

I talked up erlang in the office once and the guy that's really into languages used it as a segue to talk about lisp, him having used LFE at some point. I bet LFE could be the new hipste if they rebranded to a cute animal.

MononcQc
May 29, 2007

leper khan posted:

wow I'm out of the loop, I thought it was still phoenix/elixir.

I talked up erlang in the office once and the guy that's really into languages used it as a segue to talk about lisp, him having used LFE at some point. I bet LFE could be the new hipste if they rebranded to a cute animal.

Phoenix is a web framework for Elixir!

Alpaca used to be 'MLFE' but people kept calling it "milf" and so the guy renamed it afaict.

Asymmetrikon posted:

I was about to make a joke about needing a third OTP language, so welp

Erlang, efene, Elixir, LFE, and Alpaca for the actively developed ones compiling to the VM. luerl and erlog are interpreters for lua and prolog running on the VM. There's a few defunct languages too like Reia and Joxa.

MononcQc fucked around with this message at 23:30 on Dec 19, 2016

fritz
Jul 26, 2003

leftist heap posted:

i want to gently caress and cum in java

i hear they don't even let oracle employees gently caress it

Soricidus
Oct 21, 2010
freedom-hating statist shill
delphi was good. it was vb but with a non-garbage language. it's a shame borland decided to set themselves on fire

sarehu
Apr 20, 2007

(call/cc call/cc)
I don't get why a systems language can't use malloc everywhere. Like, it's not good for embedded, but... on a real system, you can try rolling your own custom allocators but it's IME not really worth the effort compared to jemalloc.

You still get the advantage of less memory usage, no GC pauses. And please stop whining about the semicolon thing, it's better than having the last semicolon mean nothing and having a bunch of people fighting over code style. Yeah yeah, return statements.

Here. Have a language with worse syntax to make fun of:

https://github.com/srh/starx/blob/master/starxlib/Ray.starx posted:

pre:
module Vector (vector, vec, veclen, inVector, toVector,
       	       pushback, checkrange, vecref, vecset)

// vectors
import Prelude


data vec = a: mkVector (arr = c (ray a)) (len = c int)

vector :: a: void -> vec a
vector = void: mkVector (cell (array 2)) (cell 0)

veclen :: a: vec a -> int
veclen = v: ref (len v)


inVector :: a: vec a -> iter a
inVector = v: inRayRange (ref (arr v)) 0 (ref (len v))

toVector :: a: iter a -> vec a
toVector = xs: {
    x = toRay xs;
    mkVector (cell x) (cell (length x))
}

pushback :: a: vec a -> a -> void
pushback = v:x: {
    n = veclen v;
    grow v (n + 1);
    set (ref (arr v)) n x;
    len v <- n + 1;
}

checkrange :: a: vec a -> int -> void
checkrange = v:k: {
    if (k < veclen v) {
        when (k < 0) void: {
	    error "checkrange: negative index";
	}
    } {
        error "checkrange: index too large";
    }
}

vecref :: a: vec a -> int -> a
vecref = v:k: {
    checkrange v k;
    (ref (arr v))_k;
}

vecset :: a: vec a -> int -> a -> void
vecset = v:k:x: {
    checkrange v k;
    set (ref (arr v)) k x 
}

grow :: a: vec a -> int -> void
grow = v:n: {
    k = length (ref (arr v));
    when (k < n) void: {
        k2 = max n (2 * k);
	arr2 = array k2;
	for (inZip (0...) (inRay (ref (arr v)))) ix: {
            set arr2 (fst ix) (snd ix);
	}
	arr v <- arr2
    }
}

Optional trailing semicolon, everything is an expression "because that's better," even the stupid author couldn't put the semicolon consistently.

sarehu
Apr 20, 2007

(call/cc call/cc)
And GHC can't even compile the version from 2010, it had to get tweaked to work.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

sarehu posted:

I don't get why a systems language can't use malloc everywhere.

memory/object pools. maybe rust doesn't need them but they're lifesavers in C
I've written the occasional arena allocator too, they're stupid easy and blindingly fast

sarehu
Apr 20, 2007

(call/cc call/cc)

hackbunny posted:

memory/object pools. maybe rust doesn't need them but they're lifesavers in C
I've written the occasional arena allocator too, they're stupid easy and blindingly fast

Well. Yeah. I've used them too. And the reason was, I didn't want to make a dependency outside libc.

At RethinkDB when it was supposed to be a super fast memcache replacement (or whatever) we had a src/alloc folder and did the whole thing with poo poo like
code:
template <class accessor_t, class type_t>
class alloc_mixin_t {
public:
    static void *operator new(size_t);
    static void operator delete(void *ptr);
};
being inherited by everything.

It was faster than glibc malloc, but not measurably (or at least significantly) faster than tcmalloc to be worth the hassle. (And jemalloc did a better job of giving back pages or something so eventually we switched to that.)

tef
May 30, 2004

-> some l-system crap ->

Slurps Mad Rips posted:

it bugs me that a "systems language" doesn't give me power over where i allocate objects from.

same buddy

suffix
Jul 27, 2013

Wheeee!
custom allocators seems bound to happen sooner or later, they have an placeholder feature marked unstable because they haven't committed to an api and syntax https://doc.rust-lang.org/std/boxed/constant.HEAP.html

makes sense to focus on the functional parts first as long as they have a plan to fit it in later. a custom allocator is always going to be the kind of micro-optimization you should avoid in the start, right?

30 TO 50 FERAL HOG
Mar 2, 2005



if your language uses anything but c style syntax you're just reinventing the wheel to be a unique snowflake

Arcsech
Aug 5, 2008

BiohazrD posted:

if your language uses anything but ml style syntax you're just reinventing the wheel to be a unique snowflake

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!

BiohazrD posted:

if your language uses anything but s-exprs you're just reinventing the wheel to be a unique snowflake

JawnV6
Jul 4, 2004

So hot ...

suffix posted:

a custom allocator is always going to be the kind of micro-optimization you should avoid in the start, right?

:allears: i wish i had builtins

Slurps Mad Rips
Jan 25, 2009

Bwaltow!

suffix posted:

a custom allocator is always going to be the kind of micro-optimization you should avoid in the start, right?

unfortunately a lot of important stuff c or c++ is used for (like financial, gamedev, low latency, HPC, embedded, etc.) usually ends up requiring careful memory management and rust cant possibly hope to dethrone c++ or c unless it gives that level of control.

yeah sure it's a micro-optimization if you're doing something that runs on a phone or desktop, but anything else is gonna be a pain if you dont let me say what is allocated where and when

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

BiohazrD posted:

if your language uses anything but c style syntax you're just reinventing the wheel to be a unique snowflake

lisp predates algol though

Slurps Mad Rips posted:

unfortunately a lot of important stuff c or c++ is used for (like financial, gamedev, low latency, HPC, embedded, etc.) usually ends up requiring careful memory management and rust cant possibly hope to dethrone c++ or c unless it gives that level of control.

yeah sure it's a micro-optimization if you're doing something that runs on a phone or desktop, but anything else is gonna be a pain if you dont let me say what is allocated where and when

I wish I was doing something that required careful memory management. most non-engine gamedev stuff it just doesn't come up. I have a couple extra orders of magnitude of memory and cycles for almost everything I do. :downs:

hell, most of the engine stuff I've done it hasn't been a huge deal. if object allocation is a bottleneck in your net code then lol you have problems.

I guess I could try to get a better thermal profile, but no one (especially consumers) cares.

Gul Banana
Nov 28, 2003

Bloody posted:

idk what i'd use rust for. everything systemsy i do eventually boils down into some nasty unsafe poo poo which presumably (?) would wind up infecting everything and everything else is probably more pleasant to do in c# or similar

rust actually contains unsafety really nicely - it isn't viral, you provide runtime checks or out of band invariants to maintain safe interfaces around unsafe blocks or calls

tef
May 30, 2004

-> some l-system crap ->

Slurps Mad Rips posted:

unfortunately a lot of important stuff c or c++ is used for (like financial, gamedev, low latency, HPC, embedded, etc.) usually ends up requiring careful memory management and rust cant possibly hope to dethrone c++ or c unless it gives that level of control.

yeah sure it's a micro-optimization if you're doing something that runs on a phone or desktop, but anything else is gonna be a pain if you dont let me say what is allocated where and when

basically this, yeah

it's a micro-optimization unless you actually need it

and those people who do are already writing in c++

tef
May 30, 2004

-> some l-system crap ->
thing is no, no force on earth can get people to stop using c++

i think it's a bit naive of rust to think it might attract c++ users

i mean, go thought it was like that too for a bit, until they realised the people picking up Go were mostly C, python and ruby people, the latter two just looking for static binaries and cheap performance

tef
May 30, 2004

-> some l-system crap ->

leper khan posted:

lisp predates algol though

lisp doesn't have syntax

Cabbage Disrespect
Apr 24, 2009

ROBUST COMBAT
Leonard Riflepiss
Soiled Meat

tef posted:

i kinda admire that Rc, Arc, etc are implemented inside of Rust, rather than being provided by it, but i'd rather *opt* in to uniqueness types, i'd rather stick everything on the heap and let the compiler elide what it can, using escape analysis. and at that point, start annotating what it can't handle, or what must explicitly be done.

iirc Box currently gets special compiler treatment but there is an RFC to change that

Vanadium
Jan 8, 2005

tef posted:

thing is no, no force on earth can get people to stop using c++

i think it's a bit naive of rust to think it might attract c++ users

i mean, go thought it was like that too for a bit, until they realised the people picking up Go were mostly C, python and ruby people, the latter two just looking for static binaries and cheap performance

Rust was pretty much made by C++ users who now use it instead of C++, so I think it's a reasonable aspiration.

Rust's stdlib is also modularized so you can use the bits that don't require the system allocator on their own, or plug in your own (single, global, implicit) allocator as and use everything. It's not the same as having an allocator argument in every container, but I think a custom lib with parametrized containers is more reasonable in Rust than some langs.

Is there much besides Box that's hardwired in the language and requires allocation?

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->
languages don't get popular because of their design

they just get talked about in those terms

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