Letting zoomers design your language

>Letting zoomers design your language

Attached: muh_rust.png (973x468, 82.64K)

what the fuck does reverse do? change endianness?
>push and pop
hold my beer

It seems a bit awkward at first, but it works fine and I guess this is the most minimal way to implement it
If you really don't like it you can write a wrapper or use a crate

Just wait until you find out that popping a value wrapped in reverse means you cant unwrap WITHOUT pattern matching. Enjoy your leaky abstraction hell

section .text

extern printf
global main

main:
push ebp
mov ebp, esp
sub esp, 12 ;stack allocation, it grows from the roof

push val1 ;push the values
push val2
push val3

push order
call printf

xor eax, eax
add esp, 12 ;de-allocate the stack vars as we are closing
mov esp, ebp
leave
ret

section .data

val1: db 'value one',13,10,0
val2: db 'value two',13,10,0
val3: db 'value three',13,10,0
order: db 'value 1: %svalue 2: %svalue 3: %s',13,10,0

output:
value 1: value three
value 2: value two
value 3: value one

and with a 2KB binary size

Rust bros…

Looks perfect to me, what’s your alternative?

I doubt you have any experience writing compilers or even parsing simple grammars so piss off.

I don't even know what you're trying to say, in any case you should be able to use map(). Git gud.

It's still just an option type retard.unwrap()

Unwrap and map dont work on Reverse retards, try it yourself

It's a transparent helper 1element tuple struct that turns calls to lt, le, gt, ge, cmp, etc. (which are desugared < >= operators) into the reverse versions, so less is greater and vice versa.

1. Pattern matching isn't leaky.
2. Nor is it an abstraction as you're literally looking into the guts of a type.
3. and the problem with pattern matching is?
4. yes you can some_reverse.0

Yes because unwrap is failable/panicable, extracting from a Reverse cannot fail

Could you give me a code example, I do not get what you are trying to say.

>32bit
>extern printf
>2k file size
Learn your executable format, ya poor, and use syscalls because then you don't need to link.
main:
push val1 ; you don't need to allocate, push does this for you
push val2 ; that's the point of the stack, you don't need to allocate it for small stuff
push val3
xor r12, r12 ; linux syscalls preserve these higher registers ( really nice, btw )
.lp:

; print baseline
mov edi, 1 ; stdout file descriptor
mov eax, 1 ; sys_write
mov rsi, base
mov edx, 9
syscall
add [base+6], byte 1 ; just increment the ascii on the base

; print values
mov edx, 0xff
mov rsi, [rsp+r12] ; get string pointer
xor edx, edx
mov dl, [rsi] ; get string length
inc rsi

mov edi, 1
mov eax, 1
syscall

add r12, 8
cmp r12, 24
jb .lp

mov eax, 60 ; sys_ret
xor edi, edi ; return 0
syscall
; writing your own file header means you can choose to put data in the text section like regular people
val1: db 10,"value one",10 ; string length is saved at the start of the string like normal
val2: db 10,"value two",10
val3: db 12,"value three",10
base: db "value 1: "

Output:
$ nasm test.a -o test
$ chmod 755 test
$ ./test
value 1: value three
value 2: value two
value 3: value one
$ wc -c test
264 test

Besides my macro to generate an elf header, this is my exact tested assembly.
264 bytes. Linkers are cancer and my dick is bigger than yours.

All you need to do is access the 0 field:
use std::cmp::Reverse;

fn main() {
let i : i32 = Reverse(42).0;
println!("Hello, world! {}", i);
}

>no, you can't just reuse data structures with 0 loss in performance
>if there's no longer a need to rewrite linked lists for every single type, I'm going to be out of job!

>if there's no longer a need to rewrite linked lists for every single type
Thank g-d Generics exist.

Well actually 4. works, its still leaky as you have to explicitly know the implementation used a Reverse and that you need to access my_item.0 before you get your actual data.

See Why does the end user need to know the value is wrapped in Reverse? If i have a codebase and decide to switch data structures i now have to explicitly make sure i insert values with Reverse to not break code.
Who designed this gay shit?

shift and unshift

>explicitly know the implementation used a Reverse
good thing it's a statically typed language where you need to type out the parameters, the return types and the field types, so basically everything from outside the function you can interact with
>BUT HOW WOULD I KNOW IF A HEAP I DECLARED IN THE SAME FUNCTION IS REVERSE?

>but what if I want to switch from a min heap to a max heap??
then you're a fucking moron and probably doing something wrong as it's not switching a data structure, it's switching the logic
>i now have to explicitly make sure i insert values with Reverse
make a newtype

>oomers

And why is this better? Got any code examples?

virgins

Kys massreply trannie

This.