CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Rust, how to create “Hello world” web page  (Read 136 times)

John_Betong

  • Full Member
  • ***
  • Posts: 204
  • Karma: +21/-1
    • The Fastest Joke Site On The Web
Rust, how to create “Hello world” web page
« on: 13 Oct 2021, 10:47:55 pm »
@Jason Knight,

I’m curious to know of your views regarding Rust which was introduced nearly ten years ago and now replacing parts of C in the Linux Kernel.

https://learnxinyminutes.com/docs/rust

I really like the idea that the language is compiled and should be ideal for websites.

I had a brief try and failed at producing “Hello world” and would be grateful for a Tutorial regarding web development using this Mozilla backed language.
Retired in the City of Angels where the weather suits my clothes

ingo

  • Junior Member
  • *
  • Posts: 18
  • Karma: +1/-0
Re: Rust, how to create “Hello world” web page
« Reply #1 on: 14 Oct 2021, 05:20:51 am »
Why would it be ideal for websites?

Could have a look at Nim https://nim-lang.org/ "Compiles" to C, C++ and javascript. Also webassembly.

John_Betong

  • Full Member
  • ***
  • Posts: 204
  • Karma: +21/-1
    • The Fastest Joke Site On The Web
Re: Rust, how to create “Hello world” web page
« Reply #2 on: 14 Oct 2021, 07:49:58 pm »
@ingo,
Only one compiled file to upload and rendering should be quicker.

Rust has apparently overcome C memory problems which is why the C routines are being replaced by Linux, Microsoft, etc

I like compiled languages :)


Retired in the City of Angels where the weather suits my clothes

benanamen

  • Full Member
  • ***
  • Posts: 158
  • Karma: +14/-0
Re: Rust, how to create “Hello world” web page
« Reply #3 on: 15 Oct 2021, 01:55:29 pm »
@ingo,

I like compiled languages :)

You might want to take a look at Go. (Golang)
To save time, let's just assume I am never wrong.

John_Betong

  • Full Member
  • ***
  • Posts: 204
  • Karma: +21/-1
    • The Fastest Joke Site On The Web
Re: Rust, how to create “Hello world” web page
« Reply #4 on: 15 Oct 2021, 09:02:45 pm »
@ingo,
I like compiled languages :)
You might want to take a look at Go. (Golang)

I experimented with Golang and was able to quickly produce a simple, Linux Command Line compiled application… unfortunately I was never able to create a web page to work on my Ubuntu Apache2 VPS :)


Details were raised on another forum without a satisfactory solution :(
« Last Edit: 16 Oct 2021, 04:57:19 am by John_Betong »
Retired in the City of Angels where the weather suits my clothes

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +140/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Rust, how to create “Hello world” web page
« Reply #5 on: 19 Oct 2021, 07:57:22 pm »
I have a love-hate relationship with Rust. A lot of the cryptic abbreviations (like "were too lazy to type the word function") piss me off, I hate the endless mindless shit-show of "let let let let let let let let let", but at the same time I LOVE how they organized typecasting to literally say what variables are in a uniform and future-proof construct.

It's why I'm a fan of the C99 types and hate regular C / C++ types, where you can declare "int" and depending on the compiler get a 8 bit, 16 bit, or 32 bit number, or "long" where it could be 32, 64, or even 128 bit. Don't even get me STARTED about "long long" where it could be 128 or 256.

Just like C99's uInt32, there's ZERO ambiguity when you say u32 in rust. You KNOW you're working with an unsigned 32 bit integer.

I even dislike that in Pascal and Ada, where byte/shortint == u8 / i8, word/integer = u16/i16, dword/longint is the 32 bit, qword/qLongInt is 64 bit. Though at least those are and have remained consistent the past 40 years, unlike C where you basically roll 2d6 to determine at random what each brand compiler -- or even VERSION of the same compiler -- is using.

The syntax of "print" makes me want to punch someone in the face... but I've never been a fan of things like C's "printf" or other such "template string" approaches. It gets worse with even more cryptic syntax like the gibberish <> use that -- much like typescript -- reeks of someone going "C++ was too simple, what can we do to make this as painfully and aggravatingly cryptic as possible".

Seriously, I'd sooner punch myself in the face than deploy brainf*** cryptic trash like:
Code: [Select]
impl<T> Foo<T> {
        // Methods take an explicit `self` parameter
        fn bar(&self) -> &T { // self is borrowed
            &self.bar
        }
        fn bar_mut(&mut self) -> &mut T { // self is mutably borrowed
            &mut self.bar
        }
        fn into_bar(self) -> T { // here self is consumed
            self.bar
        }
    }

... and remember, this is someone who used to hand assemble RCA 1802 machine language talking.

The worst part though is the hoops you have to jump through to even TRY to get it to spit out a website. It seems excessively poorly suited to working with the strings and organization of markup, and to that end if I were to put that type of effort in just to get a compiled language in use, I could do a hell of a lot better for the same effort.

Like by using Ada with my little pre-processor where all it does is add whitespace neutral strings to it.

Rust left me wanting. Much the same can be said of GoLang. There are far better languages already out there, and it would be nice if the folks wanting to work on compilers put more effort into those, than these mindlessly cryptic new languages that bring NOTHING new to the table.
I'll fix every flaw, I'll break every law, I'll tear up the rulebook if that's what it takes. You will see, I will crush this cold machine.

John_Betong

  • Full Member
  • ***
  • Posts: 204
  • Karma: +21/-1
    • The Fastest Joke Site On The Web
Re: Rust, how to create “Hello world” web page
« Reply #6 on: 21 Oct 2021, 05:33:05 pm »
@Jason Knight, cross-threads?

Regarding compiled languages creating monolithic files… would creating a simple menu system, that requests self contained entities, overcome the problem?

« Last Edit: 21 Oct 2021, 05:36:36 pm by John_Betong »
Retired in the City of Angels where the weather suits my clothes

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +140/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Rust, how to create “Hello world” web page
« Reply #7 on: 21 Oct 2021, 11:32:14 pm »
-- moved from misspost --

Also forgot to mention that compiled is NOT always your best friend. Interpretation done right can create a layer of hardware isolation, preventing you from doing things you shouldn't in terms of web technologies. Compiled languages tend to remove that safety net.

Likewise, compiled code is oft not very good at dynamic inclusion, which means you can end up loading and wasting memory on unused code. Units/DLLS/modules/whatever the hell else you want to call them are rarely optionally included at runtime. It tends to be an all or nothing affair whilst with interpreted because include() or its kin/kine can be set behind conditionals, you have more control over what is and isn't included.

Friend of mine found that out when he tried to use Go to create a website, then found out the monolithic code that resulted took 3x the memory of doing the same tasks from PHP... though in his case it's because he was channeling it through Apache as a normal executable for EACH page access. You can see how that can go bits-up face-down.
I'll fix every flaw, I'll break every law, I'll tear up the rulebook if that's what it takes. You will see, I will crush this cold machine.

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +140/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Rust, how to create “Hello world” web page
« Reply #8 on: 21 Oct 2021, 11:33:23 pm »
Regarding compiled languages creating monolithic files… would creating a simple menu system, that requests self contained entities, overcome the problem?
Honestly I have no idea how that's even related to the topic. What the devil does a ui element -- a menu -- have to do with dynamic code requests based on executing logic?
I'll fix every flaw, I'll break every law, I'll tear up the rulebook if that's what it takes. You will see, I will crush this cold machine.

John_Betong

  • Full Member
  • ***
  • Posts: 204
  • Karma: +21/-1
    • The Fastest Joke Site On The Web
Re: Rust, how to create “Hello world” web page
« Reply #9 on: 21 Oct 2021, 11:43:23 pm »
Regarding compiled languages creating monolithic files… would creating a simple menu system, that requests self contained entities, overcome the problem?
Honestly I have no idea how that's even related to the topic. What the devil does a ui element -- a menu -- have to do with dynamic code requests based on executing logic?

If a site has a single compiled application that renders for example ten pages the application could be 100 Mb.

Splitting the large application into a menu application and ten separate page applications  then I would expect each single application to be way smaller than a single application containing  a menu and ten pages.
Retired in the City of Angels where the weather suits my clothes

 

SMF spam blocked by CleanTalk

Advertisement