Elixir 

Oooh, so put_in, get_in and update_in are basically lenses. That's pretty cool

I don't like to rely on macros but it certainly is convenient

re: Elixir 

@socks out of curiosity, what do you not like about macros?
-F

Serious reply, re: Elixir 

@Felthry They make it very difficult to debug when something is wrong. It's not a problem at all when it's something built into the language's standard library and thoroughly well-tested but as soon as you step out of that, you're walking on thin ice

re: Serious reply, re: Elixir 

@socks I'm guessing in this context it means something more complicated than how people typically use C preprocessor macros, then?

oh and assembler macros are hard to program without, i don't want to have to remember which memory location we stored this variable in and every location we referenced it in case we have to change it
-F

re: Serious reply, re: Elixir 

@Felthry @socks Elixir is more high-level. Also I think C macros are also dark magic that's hard to test

re: Serious reply, re: Elixir 

@noiob @socks when I say how people usually use them I'm talking about things like PI 3.14159f
-F

re: Serious reply, re: Elixir 

@Felthry @socks that's what math libraries are for

re: Serious reply, re: Elixir 

@Felthry @socks or constants, rather

re: Serious reply, re: Elixir 

@noiob @socks I don't see the point in occupying a bit of memory with a constant when you could just use a macro

i imagine compilers probably optimize that out anyway but eh, habit
-F

re: Serious reply, re: Elixir 

@Felthry @noiob This is so funny to me as someone who only does higher level languages. "Occupying a bit of memory with a constant". What the heck

re: Serious reply, re: Elixir 

@socks @noiob if you say `int x = 3`, that's (bar any compiler optimizations) reserving some amount of memory (4 bytes on modern computers) for x to occupy, until it's done being x and can be used for something else (figuring out when it's done being x can be a hard problem if you don't explicitly say it's done being x, this is the cause of many memory leaks). If x is never anything other than 3, it would be more efficient to just use immediate opcodes instead of 1) taking up some memory and 2) requiring additional memory fetches (which are way slower than processor cycles)
-F

re: Serious reply, re: Elixir 

@Felthry @socks I write php, it's gonna run on a beefy machine that's running a hundred web servers in virtual machines so whether I allocate some memory or not is really not going to matter

re: Serious reply, re: Elixir 

@noiob @socks we taught ourselves how to program on a TI-84 and now primarily write code for tiny microcontrollers that cost $4, so entirely different worlds here
-F

Follow

re: Serious reply, re: Elixir 

@Felthry @socks still no reason not to use constants

re: Serious reply, re: Elixir 

@noiob @socks i think it's probably a habit from when we taught ourselves how to code on a ti-84

ti-basic doesn't have constants
-F

re: Serious reply, re: Elixir 

@Felthry @socks it probably also doesn't have a type checker or memory safety

re: Serious reply, re: Elixir 

@noiob @socks it's a calculator, what do you expect?
-F

re: Serious reply, re: Elixir 

@Felthry @socks I expect modern programming languages to be more advanced than BASIC on a calculator

Sign in to participate in the conversation
Awoo Space

Awoo.space is a Mastodon instance where members can rely on a team of moderators to help resolve conflict, and limits federation with other instances using a specific access list to minimize abuse.

While mature content is allowed here, we strongly believe in being able to choose to engage with content on your own terms, so please make sure to put mature and potentially sensitive content behind the CW feature with enough description that people know what it's about.

Before signing up, please read our community guidelines. While it's a very broad swath of topics it covers, please do your best! We believe that as long as you're putting forth genuine effort to limit harm you might cause – even if you haven't read the document – you'll be okay!