Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite in rust(🚀)? #3

Open
FedericoSchonborn opened this issue Aug 13, 2021 · 50 comments
Open

Rewrite in rust(🚀)? #3

FedericoSchonborn opened this issue Aug 13, 2021 · 50 comments
Labels
good first issue Good for newcomers

Comments

@FedericoSchonborn
Copy link

Have you considered rewriting this in rust(🚀)?

@mTvare6
Copy link
Owner

mTvare6 commented Aug 13, 2021

Can rust print hello world? because its so hard in c and I would switch to rust if we can do that

@mTvare6 mTvare6 added the good first issue Good for newcomers label Aug 13, 2021
@mTvare6 mTvare6 pinned this issue Aug 13, 2021
@mTvare6
Copy link
Owner

mTvare6 commented Aug 15, 2021

@gek169 how????????????

@Blacksuan19
Copy link

@mTvare6 README.rst????

@FedericoSchonborn
Copy link
Author

FedericoSchonborn commented Aug 15, 2021

Can rust print hello world? because its so hard in c and I would switch to rust if we can do that

Of course, hello world in rust(:rocket:) could even benefit from:

  • zero:rocket:cost :rocket: abstractions :rocket:
  • move 🚀 semantics 🚀
  • guaranteed 🚀 memory 🚀 safety 🚀
  • threads 🚀 without 🚀 data 🚀 races 🚀
  • trait:rocket:based :rocket: generics :rocket:
  • pattern 🚀 matching 🚀
  • type 🚀 inference 🚀
  • minimal 🚀 runtime 🚀
  • efficient 🚀 C(ringe) 🚀 bindings 🚀

@mTvare6
Copy link
Owner

mTvare6 commented Aug 16, 2021

Can rust print hello world? because its so hard in c and I would switch to rust if we can do that

Of course, hello world in rust(🚀) could even benefit from:

  • zero🚀cost 🚀 abstractions 🚀
  • move 🚀 semantics 🚀
  • guaranteed 🚀 memory 🚀 safety 🚀
  • threads 🚀 without 🚀 data 🚀 races 🚀
  • trait🚀based 🚀 generics 🚀
  • pattern 🚀 matching 🚀
  • type 🚀 inference 🚀
  • minimal 🚀 runtime 🚀
  • efficient 🚀 C(ringe) 🚀 bindings 🚀
  • cringe and cve binds

@mTvare6
Copy link
Owner

mTvare6 commented Aug 16, 2021

can we use the move semantics to create a coroutine that magically turns unsafe code to safe using hello world???????

yes, this program does that to convert all c binds to magic rust safety program object file thing which is very safe to run and is blazing fast

Repository owner deleted a comment from togetherwithasteria Aug 17, 2021
Repository owner deleted a comment Aug 17, 2021
@SrijithProDev-2612
Copy link

it is easy to print hello world in rust, just enter the following code and run it

fn main{
    println!("Hello World!);
}

@pan93412
Copy link

it is easy to print hello world in rust, just enter the following code and run it

fn main{
    println!("Hello World!);
}

you a newbie 👦 are definitely wrong 👎 . we 😎 usually print hello world to rust(🚀) with laser⚡️ and noto🚀 serif:

helloworld

@ayunami2000
Copy link

how has this thread gone on so long?

Because Rust(🚀) is BLAZING 🚀 fast and so is it's community (🚀). This means we stay on top of bugs 🐜, feature ✨ requests, and issues ❌. We don't let bugs 🐜, feature ✨ requests, and issues ❌ go to waste. Though, Rust(🚀) has no issues, so we just stay on top of bugs 🐜 and feature ✨ requests.

@ayunami2000
Copy link

That being said, we need a Rust(🚀) interpreter written in Rust(🚀) in order to rewrite this in Rust(🚀).

@pan93412
Copy link

pan93412 commented May 28, 2022

That being said, we need a Rust(🚀) interpreter written in Rust(🚀) in order to rewrite this in Rust(🚀).

rust-lang/rust: (slient)

@ayunami2000
Copy link

That being said, we need a Rust(🚀) interpreter written in Rust(🚀) in order to rewrite this in Rust(🚀).

rust-lang/rust: (slient)

That is not ❌ written ✍️ in Rust(🚀). It seems to use 🤢 Python 🐍...

@neu-ma-tic
Copy link
Contributor

👀

That being said, we need a Rust(🚀) interpreter written in Rust(🚀) in order to rewrite this in Rust(🚀).

rust-lang/rust: (slient)

That is not ❌ written ✍️ in Rust(🚀). It seems to use 🤢 Python 🐍...

Rust(🚀) is blazing 🚀 fast, but the python 🐍 should 💎 be ported 📡 to Rust(🚀) for max 💯 performance ⭐

@ayunami2000
Copy link

👀

That being said, we need a Rust(🚀) interpreter written in Rust(🚀) in order to rewrite this in Rust(🚀).

rust-lang/rust: (slient)

That is not ❌ written ✍️ in Rust(🚀). It seems to use 🤢 Python 🐍...

Rust(🚀) is blazing 🚀 fast, but the python 🐍 should 💎 be ported 📡 to Rust(🚀) for max 💯 performance ⭐

https://github.com/RustPython/RustPython (🚀)

@alexjpwalker
Copy link

it is easy to print hello world in rust, just enter the following code and run it

fn main{
    println!("Hello World!);
}

This code does not compile 👎 due to missing closing double quote 🙁 and thus merely serves as proof of the need for a truly minimal, robust Hello World application with guaranteed memory safety 🚀

@ShakalnyKot
Copy link

In C writing of "Hello, World" is also easy!

Create .c file with any name, then save to it this:

#include <stdio.h>
int main()
{
    puts("Hello, world!");
    return 0;
}

and then run:
gcc <name>.c -o <name>; ./<name>
(don't forget to install gcc)

@ghost
Copy link

ghost commented Oct 7, 2022

In C writing of "Hello, World" is also easy!

Create .c file with any name, then save to it this:

#include <stdio.h>
int main()
{
    puts("Hello, world!");
    return 0;
}

and then run: gcc <name>.c -o <name>; ./<name> (don't forget to install gcc)

c++ user detected??!?!?!??! wtf wtf wtf wtf smh

@ShakalnyKot
Copy link

In C writing of "Hello, World" is also easy!
Create .c file with any name, then save to it this:

#include <stdio.h>
int main()
{
    puts("Hello, world!");
    return 0;
}

and then run: gcc <name>.c -o <name>; ./<name> (don't forget to install gcc)

c++ user detected??!?!?!??! wtf wtf wtf wtf smh

💬
photo_2022-10-08_16-26-25

@ghost
Copy link

ghost commented Oct 8, 2022

In C writing of "Hello, World" is also easy!
Create .c file with any name, then save to it this:

#include <stdio.h>
int main()
{
    puts("Hello, world!");
    return 0;
}

and then run: gcc <name>.c -o <name>; ./<name> (don't forget to install gcc)

c++ user detected??!?!?!??! wtf wtf wtf wtf smh

speech_balloon photo_2022-10-08_16-26-25

иди нахуй

@ShakalnyKot
Copy link

In C writing of "Hello, World" is also easy!
Create .c file with any name, then save to it this:

#include <stdio.h>
int main()
{
    puts("Hello, world!");
    return 0;
}

and then run: gcc <name>.c -o <name>; ./<name> (don't forget to install gcc)

c++ user detected??!?!?!??! wtf wtf wtf wtf smh

speech_balloon photo_2022-10-08_16-26-25

иди нахуй

C лучший

@mTvare6
Copy link
Owner

mTvare6 commented Oct 8, 2022

In C writing of "Hello, World" is also easy!

Create .c file with any name, then save to it this:

#include <stdio.h>
int main()
{
    puts("Hello, world!");
    return 0;
}

and then run:
gcc <name>.c -o <name>; ./<name>
(don't forget to install gcc)

I don't think it's as easy as rust version, anyway it seems to segfault on my toaster running arch

@ghost
Copy link

ghost commented Oct 9, 2022

I don't think it's as easy as rust version, anyway it seems to segfault on my toaster running arch

Not memory safe =|

@ShakalnyKot
Copy link

In C writing of "Hello, World" is also easy!
Create .c file with any name, then save to it this:

#include <stdio.h>
int main()
{
    puts("Hello, world!");
    return 0;
}

and then run:
gcc <name>.c -o <name>; ./<name>
(don't forget to install gcc)

I don't think it's as easy as rust version, anyway it seems to segfault on my toaster running arch

there are just nothing to cause segfault

@joseluisq
Copy link

I believe that if you include the right headers then your can make your C code safe and reliable.

That said, below is an industry-standard well-established piece of code to illustrate what I'm saying.

// SAFETY?: You **must** include the right std header down here,
// if you don't have it then go lazy and use "bindgen" to get one.
// Or even better (safer), include a Rust version of it like "rust_stdio.rs" directly,
// the only downside is that you have to export the whole Rust std into a single file.
// But hey! Rust was thought to be a C/C++ **replacement**
// so it **must** integrate like a charm with cringe C code.
// Do you even think to question that?
#include <rust_stdio.h>

int main()
{
    printf("Hello, world!");
    return 0;
}

P.d. Of course, binary size can vary some MB depending on your target. So at that point, you have to blame LLVM or GCC, at your option.

@ShakalnyKot
Copy link

I believe that if you include the right headers then your can make your C code safe and reliable.

That said, below is an industry-standard well-established piece of code to illustrate what I'm saying.

// SAFETY?: You **must** include the right std header down here,
// if you don't have it then go lazy and use "bindgen" to get one.
// Or even better (safer), include a Rust version of it like "rust_stdio.rs" directly,
// the only downside is that you have to export the whole Rust std into a single file.
// But hey! Rust was thought to be a C/C++ **replacement**
// so it **must** integrate like a charm with cringe C code.
// Do you even think to question that?
#include <rust_stdio.h>

int main()
{
    printf("Hello, world!");
    return 0;
}

P.d. Of course, binary size can vary some MB depending on your target. So at that point, you have to blame LLVM or GCC, at your option.

Ohhhhh... if we care about memory safety, we shouldn't use printf with one arg
Due of printf implementation it can cause memory issules
so, for printing of hello world better use simpler puts
or do:

#include <rust_stdio.h>

int main()
{
    printf("Hello, world!", NULL);
    return 0;
}

@TricolorHen061
Copy link

I believe that if you include the right headers then your can make your C code safe and reliable.
That said, below is an industry-standard well-established piece of code to illustrate what I'm saying.

// SAFETY?: You **must** include the right std header down here,
// if you don't have it then go lazy and use "bindgen" to get one.
// Or even better (safer), include a Rust version of it like "rust_stdio.rs" directly,
// the only downside is that you have to export the whole Rust std into a single file.
// But hey! Rust was thought to be a C/C++ **replacement**
// so it **must** integrate like a charm with cringe C code.
// Do you even think to question that?
#include <rust_stdio.h>

int main()
{
    printf("Hello, world!");
    return 0;
}

P.d. Of course, binary size can vary some MB depending on your target. So at that point, you have to blame LLVM or GCC, at your option.

Ohhhhh... if we care about memory safety, we shouldn't use printf with one arg Due of printf implementation it can cause memory issules so, for printing of hello world better use simpler puts or do:

#include <rust_stdio.h>

int main()
{
    printf("Hello, world!", NULL);
    return 0;
}

Yes, but would this code be blazingly fast(🚀)???

@ShakalnyKot
Copy link

I believe that if you include the right headers then your can make your C code safe and reliable.
That said, below is an industry-standard well-established piece of code to illustrate what I'm saying.

// SAFETY?: You **must** include the right std header down here,
// if you don't have it then go lazy and use "bindgen" to get one.
// Or even better (safer), include a Rust version of it like "rust_stdio.rs" directly,
// the only downside is that you have to export the whole Rust std into a single file.
// But hey! Rust was thought to be a C/C++ **replacement**
// so it **must** integrate like a charm with cringe C code.
// Do you even think to question that?
#include <rust_stdio.h>

int main()
{
    printf("Hello, world!");
    return 0;
}

P.d. Of course, binary size can vary some MB depending on your target. So at that point, you have to blame LLVM or GCC, at your option.

Ohhhhh... if we care about memory safety, we shouldn't use printf with one arg Due of printf implementation it can cause memory issules so, for printing of hello world better use simpler puts or do:

#include <rust_stdio.h>

int main()
{
    printf("Hello, world!", NULL);
    return 0;
}

Yes, but would this code be blazingly fast(rocket)???

Yes

@ShakalnyKot
Copy link

ShakalnyKot commented Oct 28, 2022

Let's go to my pseudolanguage

#Import "LangBase";

/* connect to rust runtime */
#Set Exec.Lang = Rust;
#Set Compiler.EnableExtensions = { RustSupport, RustMacros };
#Set Compiler.EnableLangFeatures = { Rust.BorrowCheching, Rust.SafetyExtension };
#Set Compiler.DisableLangFeatures = { SKPseudoLang.OOP };

/* import rust std */
#Import "(Rust):std" => std;
#Set Exec.Entry = (Objectless):Main();

@Lang:Rust
_none Main()
{
  (RustMacros)println(&"Hello to world of madness!");
};

@nitreojs
Copy link

shakalnykot just dropped a C(ringe)

@ShakalnyKot
Copy link

shakalnykot just dropped a C(ringe)

  1. It's rusty cringe

2:

Syntax Error - expected end of linker directive expression:
 13 | @Lang:Rust
                ^
               here
Fix: add semicolon:
 13 | @Lang:Rust;

@ShakalnyKot
Copy link

shakalnykot just dropped a C(ringe)

1. It's rusty cringe

2:

Syntax Error - expected end of linker directive expression:
 13 | @Lang:Rust
                ^
               here
Fix: add semicolon:
 13 | @Lang:Rust;
3. you are cringe

I know. But Rustaceans is more cringe

Repository owner deleted a comment Nov 5, 2022
Repository owner deleted a comment Nov 5, 2022
@ghost
Copy link

ghost commented Nov 23, 2022

Obviously you haven't tried AbleScript.

/*Hello, world!*/ print;

@TruncatedDinoSour
Copy link
Contributor

Obviously you haven't tried HQ9+.

H

@FedericoSchonborn
Copy link
Author

Obviously you haven't tried HQ9+.

H

Not to be confused with h:

h

@ShakalnyKot
Copy link

Obviously you haven't tried HQ9+.

H

Not to be confused with h:

h

SVM + svmasm
💀

_start:
    spush 'H'
    scall putchar
    sclr
    spush 0
    scall exit

@TruncatedDinoSour
Copy link
Contributor

Obviously you haven't tried HQ9+.

H

Not to be confused with h:

h

SVM + svmasm skull

_start:
    spush 'H'
    scall putchar
    sclr
    spush 0
    scall exit

Why doesn't this look like valid asm
Anyway
x86_64 Linux FASM assembly:

format ELF64 executable 3
segment readable executable

define SYS_exit  60
define SYS_write 1

_start:
    mov eax, SYS_write
    mov edi, 1
    mov esi, c
    mov edx, clen
    syscall

    mov eax, SYS_exit
    xor edi, edi
    syscall

segment readable
    c: db "h", 10
    clen = $ - c

@ShakalnyKot
Copy link

x86_64 Linux GAS assembly:

.section .text
	.global _start
	_start:
		mov $1, %rax
		mov $1, %rdi
		mov $str, %rsi
		mov $2, %rdx
		syscall
		mov $60, %rax
		xor %edi, %edi
		syscall
.section .data
	.global str
	str:
		.byte 'h'
		.byte 10

@TruncatedDinoSour
Copy link
Contributor

x86_64 Linux GAS assembly:

.section .text
	.global _start
	_start:
		mov $1, %rax
		mov $1, %rdi
		mov $str, %rsi
		mov $2, %rdx
		syscall
		mov $60, %rax
		xor %edi, %edi
		syscall
.section .data
	.global str
	str:
		.byte 'h'
		.byte 10

x86_64 Linux NASM assembly:

BITS 64

segment .text
global _start

_start:
    mov eax, 1
    mov edi, 1
    mov esi, c
    mov edx, clen
    syscall

    mov eax, 60
    mov edi, 0
    syscall

segment .rodata
    c: db "h", 10
    clen: equ $ - c

@ShakalnyKot
Copy link

x86_64 Linux GAS assembly:

.section .text
	.global _start
	_start:
		mov $1, %rax
		mov $1, %rdi
		mov $str, %rsi
		mov $2, %rdx
		syscall
		mov $60, %rax
		xor %edi, %edi
		syscall
.section .data
	.global str
	str:
		.byte 'h'
		.byte 10

x86_64 Linux NASM assembly:

BITS 64

segment .text
global _start

_start:
    mov eax, 1
    mov edi, 1
    mov esi, c
    mov edx, clen
    syscall

    mov eax, 60
    mov edi, 0
    syscall

segment .rodata
    c: db "h", 10
    clen: equ $ - c

x86_64 Linux GAS assembly:

.section .text
   .global _start
   _start:
   mov $1, %rax
   mov $1, %rdi
   mov $str, %rsi
   mov $2, %rdx
   syscall
   mov $60, %rax
   xor %edi, %edi
   syscall
.section .data
   .global str
   str:
   	.byte 'h'
   	.byte 10

@TruncatedDinoSour
Copy link
Contributor

x86_64 Linux GAS assembly:

.section .text
	.global _start
	_start:
		mov $1, %rax
		mov $1, %rdi
		mov $str, %rsi
		mov $2, %rdx
		syscall
		mov $60, %rax
		xor %edi, %edi
		syscall
.section .data
	.global str
	str:
		.byte 'h'
		.byte 10

x86_64 Linux NASM assembly:

BITS 64

segment .text
global _start

_start:
    mov eax, 1
    mov edi, 1
    mov esi, c
    mov edx, clen
    syscall

    mov eax, 60
    mov edi, 0
    syscall

segment .rodata
    c: db "h", 10
    clen: equ $ - c

x86_64 Linux GAS assembly:

.section .text
   .global _start
   _start:
   mov $1, %rax
   mov $1, %rdi
   mov $str, %rsi
   mov $2, %rdx
   syscall
   mov $60, %rax
   xor %edi, %edi
   syscall
.section .data
   .global str
   str:
   	.byte 'h'
   	.byte 10

you already sent that one

@ShakalnyKot
Copy link

x86_64 Linux GAS assembly:

.section .text
	.global _start
	_start:
		mov $1, %rax
		mov $1, %rdi
		mov $str, %rsi
		mov $2, %rdx
		syscall
		mov $60, %rax
		xor %edi, %edi
		syscall
.section .data
	.global str
	str:
		.byte 'h'
		.byte 10

x86_64 Linux NASM assembly:

BITS 64

segment .text
global _start

_start:
    mov eax, 1
    mov edi, 1
    mov esi, c
    mov edx, clen
    syscall

    mov eax, 60
    mov edi, 0
    syscall

segment .rodata
    c: db "h", 10
    clen: equ $ - c

x86_64 Linux GAS assembly:

.section .text
   .global _start
   _start:
   mov $1, %rax
   mov $1, %rdi
   mov $str, %rsi
   mov $2, %rdx
   syscall
   mov $60, %rax
   xor %edi, %edi
   syscall
.section .data
   .global str
   str:
   	.byte 'h'
   	.byte 10

you already sent that one

how to install xen hypervisor?

@ghost
Copy link

ghost commented Dec 2, 2022

how to install xen hypervisor?

https://google.com

@TruncatedDinoSour
Copy link
Contributor

how to install xen hypervisor?

https://google.com

https://searx.tiekoetter.com/

@ShakalnyKot
Copy link

how to install xen hypervisor?

https://google.com

thanks, i already installed on my test stand with devuan

@prechelt
Copy link

how to install xen hypervisor?

Oh! I was not aware that Xen has already been reimplemented in Rust.
Great!

@ajskateboarder
Copy link

Rust 🚀 is 🚀🔥🚀🔥 blazingly 🔥🚀🔥 fast 🔥🚀🔥🚀🔥 and 🚀🚀🚀🚀🔥 memory 🚀 efficient 🔥🚀🚀🚀🚀: with no 🚀 runtime 🚀 or 🚀 garbage collector 🔥🚀🚀🔥, it can power 🚀🚀🚀 performance-critical 🚀🔥🚀 services 🚀🔥, run on embedded 🚀 devices 🚀, and easily integrate 🚀🔥 with other languages 🚀. Rust’s 🚀 rich 🚀 type system 🚀 and ownership model 🚀 guarantee 🚀🔥🚀🔥🚀🔥🚀 memory-safety 🔥🚀🔥🚀🔥🚀🔥🚀🔥 and 🚀 thread-safety 🚀 — enabling you to 🚀 eliminate 🚀 many classes of 🚀🚀 bugs 🚀🚀 at 🚀 compile-time 🚀.

@UniqueName12345
Copy link

UniqueName12345 commented Mar 14, 2023

Have you considered rewriting this in rust(🚀)?

Isn't this already in rust lmao

@TruncatedDinoSour
Copy link
Contributor

Have you considered rewriting this in rust(🚀)?

Isn't this already in rust lmao

💀💀💀

@UniqueName12345
Copy link

Have you considered rewriting this in rust(🚀)?

Isn't this already in rust lmao

💀💀💀

Oh right. forgot rust(🚀) was a different language from rust

@UniqueName12345
Copy link

UniqueName12345 commented Apr 5, 2023

Obviously you haven't tried HQ9+.

H

This is an awful implementation! It isn't memory safe nor efficient at all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

17 participants