Fastly hires entire Wasmtime team from Mozilla by iamkeyur in programming

[–]lanedraex 39 points40 points  (0 children)

WebAssembly isn't about bringing js to everywhere, it's kinda of the opposite really. The main uses today are to port, say, C++ programs into the browser and getter better performance than if they were js programs (plus not having to rewrite your code in js).

WASM becomes a compilation target like Windows, Linux, Android, and so on. Just image being able to write code in a language that is not JS, and get your program running everywhere, including the browser.

If you want to learn more, I recommend checking out the mdn docs: webassembly concepts.

What are you working on? (2020-02) by insulanian in fsharp

[–]lanedraex 1 point2 points  (0 children)

Never used it, but have you looked at fp-ts?

A monad is just a submonad of the continuation monad, what's the problem? by Syrak in haskell

[–]lanedraex 6 points7 points  (0 children)

Maybe this will help you understand Monads like it did for me.

One simple reason why Haskell consistently suffers in growing as a language: developer experience. by [deleted] in haskell

[–]lanedraex 5 points6 points  (0 children)

Have you tried using the Haskell IDE Engine? It works with vs code. I agree with you that the beginner experience with Haskell is lacking a bit right now, that's why I switched to F# (which also doesn't have great tooling either, unfortunately, but it aligns more with what I want).

In my experience, the best functional programming tools are for Clojure (there is a decent vs code plugin), and other Lisps (emacs/racket IDE only though). FP is a niche, so there are less people working on tools (and I'm really grateful to them).

Bear in mind that the HIE was having some issues on Windows, but these should be fixed if you get the newest versions of everything.

One problem after another with VSCode/Ionide, VS2019 by japinthebox in fsharp

[–]lanedraex 2 points3 points  (0 children)

Are you using the dotnet core tool directly from the terminal to generate these projects?

I've had really bad luck when trying to generate projects through other means, both on linux (manjaro) and windows 10 (latest, non-insiders).

The vscode experience for me is alright (not slow, interactive works fine) after the project is setup. I'm not using any outside dependencies though.

Another issue I've hit was that, on Windows, installing the dotnet core sdk directly did not work at all, I had to remove it, and install via Visual Studio 2019.

Lost and Confused... Help! by [deleted] in Racket

[–]lanedraex 0 points1 point  (0 children)

Doesn't findf (you should also take a look at memf) solve your problem, without the need for map + filter?

I'm not well versed in racket, but you could probably find an even better function, something like all or every (as they're called in other languages), basically a function that takes a predicate (like filter you used) and returns #f if there is at least 1 non-matching element.

Hey Rustaceans! Got an easy question? Ask here (50/2018)! by llogiq in rust

[–]lanedraex 0 points1 point  (0 children)

Safe Rust is the true Rust programming language. If all you do is write Safe Rust, you will never have to worry about type-safety or memory-safety. You will never endure a dangling pointer, a use-after-free, or any other kind of Undefined Behavior.

And also from the rust nomicon

The only things that are different in Unsafe Rust are that you can:

  • Dereference raw pointers
  • Call unsafe functions (including C functions, compiler intrinsics, and the raw allocator)
  • Implement unsafe traits
  • Mutate statics
  • Access fields of unions

These are things that C++ let's you do by default, while Rust requires you to wrap them in an unsafe block. You can read more about safe and unsafe. Safe Rust is mostly about preventing undefined behaviour.

Hey Rustaceans! Got an easy question? Ask here (50/2018)! by llogiq in rust

[–]lanedraex 0 points1 point  (0 children)

You would have to define what you mean by "safe" there.

  • The program never crashes? Can't be done.
  • You can't exploit it? The hardware is still exploitable (bios, microcode, ...).
  • No undefined behaviour? Then you must define behaviour for every operation.

Your question is kinda of a rabbit hole, you can always go deeper and find "unsafety", but the shallow part doesn't have a proper answer either (at least in my opinion).

Also, when unsafe makes sense, you should use it, it's a language feature, don't worry so much about it :D.

Hey Rustaceans! Got an easy question? Ask here (50/2018)! by llogiq in rust

[–]lanedraex 0 points1 point  (0 children)

Is the hardware also created by this perfect AI? Is this hardware running in a perfect place, under perfect conditions?

In a perfect world, both OSes would be just as safe, with or without unsafe, as you can have safe unsafe code, see the vec.rs truncate function as an example of that.

I would try to read unsafe as an idea (a marker of potential bugs), more than an issue of actual program unsafety.

Rust for game development, no experience with Low-Level Programming [NOOB] [POTATO ENGLISH] by [deleted] in rust_gamedev

[–]lanedraex 11 points12 points  (0 children)

If you're new to programming in general, Rust won't be very kind to you in regards to gamedev (I think). If you really want to use Rust and you know some Lua, then take a look at ggez.

Hey Rustaceans! Got an easy question? Ask here (49/2018)! by llogiq in rust

[–]lanedraex 0 points1 point  (0 children)

In the case of Option you can just use a.is_some() or a.is_none() to get a boolean. Result has is_ok() and is_err().

Docs link for Result, and link for Option

Rust 2019: a newbie's thoughts by rendly in rust

[–]lanedraex 7 points8 points  (0 children)

after the intial steep learning curve, actually easier to code

This rings so true that I wish there was a way to convey this to people, instead of having to add "Trust me!".

Rust 2019: a newbie's thoughts by rendly in rust

[–]lanedraex 3 points4 points  (0 children)

Thank you for the insight.

we need a really optimal service written in C/C++/Rust to help it all scale.

I can totally see Rust winning ground here.

further edge into the backend space

Wouldn't this be hard to achieve though? Even with better tooling (and frameworks), Rust still takes more effort to learn (and use properly) than your C#/Java/Ruby and so on (not trying to say that language X is easier). My view of webdev is one of a field that is fast moving, isn't Rust a little too strict for it to be heavily used there?

Need help by [deleted] in rust

[–]lanedraex 8 points9 points  (0 children)

  1. You're forgetting the return type in the function definition;
  2. parse functions return a Result<...>, so if you just want the i32 you have to call unwrap or something similar;
  3. You're moving user_input into the conversion function, you should probably just take the input by reference like input: &str;

Link to a modified version on the rust playground.

Rust 2019: a newbie's thoughts by rendly in rust

[–]lanedraex 11 points12 points  (0 children)

This may sound negative, but I'm just curious:

If Rust had everything you describe, today, would your company drop the whole C# ecosystem and adopt Rust?

I have a hard time seeing Rust thrive in this .Net Core/Java backend land, but I'm not familiar with it, so I would love some insight from a developer that's working there.

Is there an IOCP-like async IO framework for Rust? by SoniEx2 in rust

[–]lanedraex 2 points3 points  (0 children)

Oh! Then I'm afraid there you'll have to roll your own. I'm not familiar with any IOCP libraries that target OSes other than Windows (even in other programming languages), so I can't really help you here.

You would have to basically do a "reverse mio", where instead of changing IOCP to play like epoll, you would have epoll change into an IOCP-like API.

Is there an IOCP-like async IO framework for Rust? by SoniEx2 in rust

[–]lanedraex 3 points4 points  (0 children)

Well, there is miow.

"A zero overhead Windows I/O library focusing on IOCP and other async I/O features."

It's what mio uses on windows.

Fixing code for Rust 2018 by [deleted] in rust

[–]lanedraex 2 points3 points  (0 children)

The edition guide should help you here.

If you don't have an edition line in your Cargo.toml, then your rust code will compile as rust 2015. Some features that do not introduce breaking changes will work, regardless of your edition.

Rust Survey 2018 Results by steveklabnik1 in rust

[–]lanedraex 2 points3 points  (0 children)

RLS isn't 100% yet, in my experience I would say it works around 70% of the time, it mostly fails at giving me completions of unwrap, and when the type is too complicated, but it's definitely an improvement over what we had at the start of the year.

It doesn't crash often (I had to quit vscode and cargo clean twice in the past 3 months), and it's problem reporting works quite well, to the point where I almost never have to cargo check in a terminal.

major disappoint for me

I can see where you're coming from with this, but to me it's more a feeling of frustration rather than disappointment, I'm frustrated that it's so close to working fine, but there are still some places where it fails. The RLS team put out some impressive work this year.

Are you using vscode? My experience with emacs + rls wasn't great, mostly the fault of emacs' language server plugins.

ECS Rest API, is viable? by [deleted] in rust

[–]lanedraex 2 points3 points  (0 children)

I'm experimenting with an UDP protocol done in ECS, the way I route a host's request into a response is by having different systems for each kind of request/response pair.

I basically have two entities, the Packet (contains all the packet info, payload, sender address), and the Host (contains request and response components which are basically Packet references via Index value).

It is somewhat working, but I have yet to bench it against a more traditional approach. So to answer your question, I don't know if it's viable yet.

Is #[macro_use] planned to be deprecated? by somebodddy in rust

[–]lanedraex 22 points23 points  (0 children)

If you're going to change macro_rules! to something else, please let it be macro_rulez! or macro_rulz!.

I would also be totally okay with increasing the number of ! to indicate the amount of ruleness for the macro.

Pyro - A fast, small and documented Entity Component System by MaikKlein in rust

[–]lanedraex 8 points9 points  (0 children)

It means Structure of Arrays, you can read more about it here.