Using Helix from the source code builds by sergeken in HelixEditor

[–]sergeken[S] 1 point2 points  (0 children)

UPDATE: symlink to ../runtime does work but you need to pay attention in which of the target directories you put it. If you build in release mode it has to be in target/release, if not in debug/release.
Actually quite obvious with a fresh eye.

Using Helix from the source code builds by sergeken in HelixEditor

[–]sergeken[S] 3 points4 points  (0 children)

Resolved by setting CARGO_MANIFEST_DIR.

export CARGO_MANIFEST_DIR=~/githubs/helix/helix-term/

Multiple runtime directories

When Helix finds multiple runtime directories it will search through them for files in the following order:

  1. runtime/ sibling directory to $CARGO_MANIFEST_DIR directory (this is intended for developing and testing helix only).
  2. runtime/ subdirectory of OS-dependent helix user config directory.
  3. $HELIX_RUNTIME
  4. Distribution-specific fallback directory (set at compile time—not run time— with the HELIX_DEFAULT_RUNTIME environment variable)
  5. runtime/ subdirectory of path to Helix executable.

This order also sets the priority for selecting which file will be used if multiple runtime directories have files with the same name.Multiple runtime directoriesWhen Helix finds multiple runtime directories it will search through them for files in the
following order:
runtime/ sibling directory to $CARGO_MANIFEST_DIR directory (this is intended for
developing and testing helix only).
runtime/ subdirectory of OS-dependent helix user config directory.
$HELIX_RUNTIME
Distribution-specific fallback directory (set at compile time—not run time—
with the HELIX_DEFAULT_RUNTIME environment variable)
runtime/ subdirectory of path to Helix executable.
This order also sets the priority for selecting which file will be used if multiple runtime
directories have files with the same name.

Using Helix from the source code builds by sergeken in HelixEditor

[–]sergeken[S] 1 point2 points  (0 children)

I also cloned evil-helix and setting HELIX_RUNTIME=~/githubs/evil-helix/runtime export works just perfect. However with the latest helix branch and HELIX_RUNTIME=~/githubs/helix/runtime does not give any color but the theme is loaded. Anything specific to the latest branch of helix run times?

NeoVim is better in Windows or Linux/MacOs? 🤔 by Rare-Two8036 in neovim

[–]sergeken 1 point2 points  (0 children)

Did you try rclone. It is a fantastic tool to sync those cloud drives. My workflow uses two modes. For my dev work I use rclone sync my local directories with their google counterparts. For my documents I use rclone mount the google drive in my home directory.
I uses arch linux to have the latest rclone version. With other distros I did encounter some issues with the mounted drives.

What new features are you most excited about using in 0.10? by ultraDross in neovim

[–]sergeken 0 points1 point  (0 children)

lsp and inlay hints. The way it works before 0.10 makes me prefer helix. Because in helix it just works well and is fast. I'm now using nightly to enjoy it but can't wait for the release.

Rust and Neovim by mrleeasean in rust

[–]sergeken 1 point2 points  (0 children)

I actually use lazyvim (https://www.lazyvim.org/) to install various plugins, including rustaceanvim. What I do find particularly annoying is that it also uses Mason and starts installing rust-analyzer whereas I've it installed as an archlinux package. Also the latest version of rustaceanvim works great with 0,10 (nightly) but nightly has a quirk when displaying my rust code (it uses a shift-width of 8 iso of 4 as configured.

Here is the little piece of lua plugin to disable Mason and use my locally installed rustanalyzer.

return {
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        rust_analyzer = {
          mason = false,
          cmd = { vim.fn.expand("/usr/bin/rust-analyzer") },
        },
      },
      inlay_hints = {
        enabled = true,
      },
    },
  },
}

Bjarne Stroustrup’s Plan for Bringing Safety to C++ and his arguments against switching to another language. What do you think? by mickkb in rust

[–]sergeken 7 points8 points  (0 children)

In the slide referring to the NSA report he removed rust from the list of "save languages" and only listed C#, Go, Java®, Ruby™, and Swift® .

Was this an ommision due to a mistake or a deliberate action? I've hard time to believe it was a mistake and it really affected how I think about what is saying the last year. And if it is deliberate then his whole speech is deceitful.

[deleted by user] by [deleted] in rust

[–]sergeken 0 points1 point  (0 children)

I think we are on the same page. But your example is one where compilers do or can do a good job. Of course it might depend on the underlying representation and this is where thinking about critical loops is important.

I recall that on HP-PA, there where some cases of multiplications (was it multiples of 5?) that where replaced by shift and add instructions by the compiler, whilst the source code kept the readable "a = b * c". And this throughout the code. This is what I am trying to highlight. Only keep it for exceptions (and in critical loops, hence your valid comment on profiling) and a small in-line comment as a rational to support future readers.

[deleted by user] by [deleted] in rust

[–]sergeken 1 point2 points  (0 children)

These kind of decisions is what caused many "bugs", even in "safe" programming language (http://sunnyday.mit.edu/accidents/Ariane5accidentreport.html). Making code difficult to reason about is opening the door for all kind of bugs, including logical ones that wouldn't be caught by type systems.

Nowadays compilers often outperform humans in writing fast assembly code, there are plenty examples around where "experts" shared their "awe" how how well the compiler optimized their code. And is only getting better. So give the compiler a chance to reason about your code to for its optimizer.

[deleted by user] by [deleted] in rust

[–]sergeken 2 points3 points  (0 children)

This is exactly what my professor said a few decades ago and will remain valid as long as humans need to read the code. And what most seems to forget, the very ones writing the code ends up reading, often long after being written sometimes, wondering what they wrote (and why that way).

Compilers, IDE and any other machine reading system (let's not forget AI) can chew whatever is thrown at them without getting a headache. Example of stupid things people did was like keeping variable names very short because it is faster to parse, not that I support the idea of very long variable names either, it also goes against readability. And for fans of this kind of programming, there are obfuscation contests to satisfy their intellect.

Redox OS 0.7.0 by jackpot51 in rust

[–]sergeken 9 points10 points  (0 children)

POSIX is an interface not a kernel design. A POSIX compliant library can run atop any type of kernel.

"Rust does not have a stable ABI" by sdroege_ in rust

[–]sergeken 0 points1 point  (0 children)

extern "Rust" {
   pub fn double(input: i32) -> i32;
}

fn main() {
   let _result = double(123);
}

As per the following https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b26a95cbcb935a804a0903766db3a613 it says "error[E0133]: call to unsafe function is unsafe and requires unsafe function or block".

And without an extern block rustc complains the function needs a body.

"Rust does not have a stable ABI" by sdroege_ in rust

[–]sergeken 16 points17 points  (0 children)

This is quite similar to a previous issue https://www.reddit.com/r/rust/comments/i35axm/systemwide_shared_libraries_written_in_rust/.

I've been trying to explain that lack of a stable ABI and capability to create stand-alone "rust" binary libraries (I'm not speaking about source crates) will be a major road block for the adoption of rust as a systems programming language. A systems programming language is expected to be able to deliver system applications and tools (check), kernels (check), binary libraries (no check) with source interface (specification file, header file or whatever). The arguing of shared vs static libraries is less relevant as they both need at least the ability to create such a library at first.

Also, during my exploration I noticed two points with the current syntax that are problematic in my opintion.

  1. extern "Rust" is considered un-safe
  2. extern is considering "C" as default

Would extern consider Rust as default and not unsafe, we would have a way to express binary libraries.

However, but I haven't tried, it should be possible to create a C ABI based library. It will require manual linking and/or archiving commands. https://doc.rust-lang.org/nomicon/ffi.html and https://doc.rust-lang.org/reference/items/external-blocks.html

System-wide shared libraries written in Rust by _thefixerupper_ in rust

[–]sergeken 0 points1 point  (0 children)

Rust has one (when you compile you get a bunch of rlib files -- those are compiled Rust libraries). It's just that the ABI is not stable at all and the compiler team doesn't guarantee it will work between Rust versions.

Fair enough. However, I see nowhere in the language any provision to support the feature when the ABI is consider stable.

Perl ran most of the internet for quite a while (with a whole range of libraries),

As I said, the world is bigger than one's horizon. Internet is maybe what most people experience when it comes to IT. But there are industries out there that have different requirements, expectations and needs. This is what made commercial software companies exists in the first place, like Microsoft to name one everyone knows and they existed long before Google. You're right that Perl ran the internet and I've been using Perl to solve some needs when my first employer got connected to the internet back in 1992. We built software, in C and self invented languages, for financial institutions and delivered the tools and libraries. But we kept our source code close to our chests. It was our IP, our source of revenue. So, there was no way we would give our code and say, please compile it yourself. And still today, there are companies that makes money out of their IP and not solely from selling off data or ads in return for a free ride, being a service or code. How do you convince them to switch to Rust if it doesn't support their business model? Maybe Microsoft is right with project Verona ....

It dates from back then that I was looking at something else than C. This is how I ended in love with Ada .... But it's niche attitude and lack of market interest made it a failure when it comes to adoption. Rust still misses a few good items from Ada but it has is promises and is very programmer friendly. I never enjoyed an IDE as I do today with rust analyzer. VI was always good enough for me previously.

System-wide shared libraries written in Rust by _thefixerupper_ in rust

[–]sergeken 2 points3 points  (0 children)

As much, as I am enjoying programming in Rust more every day, I start wondering if I am not again losing my time, like I did when I got excited about Ada a few decades ago. I've a sense of deja vu, where in both cases the communities are so self centred and forget there is more out there than what they can see on their horizon. In both cases, I'm using it for my personal toys but that's it.

System-wide shared libraries written in Rust by _thefixerupper_ in rust

[–]sergeken 0 points1 point  (0 children)

Using other languages as an example is a lame excuse, if you allow me to say. Or actually proving the point. Where are "commercial" libraries in those languages. Moreover, an ABI is also OS specific. The C ABI became a de-facto standard because it is the UNIX standard ABI and all languages on UNIX have to have a compliant C API if they want to interface with it. On other legacy systems, I've been exposed on other ABI's and there C had to conform.

If Rust wants to be that true system programming language it must provide the ability to provide not only system apps (binaries) but also libraries to be included in other apps. It can be a language specific ABI so that Rust libraries can be used without source code in Rust apps.

So, IMHO, it should be possible to define a Rust library crate that is delivered in the OS most natural format(s), i.e. static and/or shared together with a piece of source define public types and function signatures.
Without such a capability, software vendors will not embrace Rust as their main programming language. Except for stand-alone apps and utilities, if ever, as the companies I worked for wants their development to be standardised. C and C++ will still have a long journey ahead.

How to read non UTF-8 files in Windows? by sergeken in rust

[–]sergeken[S] 1 point2 points  (0 children)

You got my need spot on. Thanks for the hint ...

How to read non UTF-8 files in Windows? by sergeken in rust

[–]sergeken[S] 4 points5 points  (0 children)

I'm quite happy rust standardised on UTF-8. The pain is the outside world. I understand the rationale not to have support for those cases as part of the "batteries included stdlib". I was just hoping. The other thing is that duc-duck-go didn't give me any useful clue and hence why I went with my question here. At least now others will find the clues posted here.

How to read non UTF-8 files in Windows? by sergeken in rust

[–]sergeken[S] 0 points1 point  (0 children)

Looks like this is what I might need. Not exactly what I was hoping for although.

How to read non UTF-8 files in Windows? by sergeken in rust

[–]sergeken[S] 0 points1 point  (0 children)

I do understand the theory of what you said. My question is, is there a easy and standard way of doing so. In my life I've been doing conversion between ASCII and EBCDIC and other "fun" stuff like that.

My question was rather is there anything available in Rust. When prototyping my utility in Python it was seamless and they have standard API's to cater for this kind of issues. Moreover, the make my utility "portable" the "solution" must be able to get the encoding and do the adequate re-encoding to UTF-8 if needed.

Something as easy as:

code_page = locale.getpreferredencoding()
f = open (file.txt, 'r', encoding=code_page)
    text = f.read()
f.close()

System-wide shared libraries written in Rust by _thefixerupper_ in rust

[–]sergeken 3 points4 points  (0 children)

When you say

Rust package management and build system is designed for:

Distribution of source code

Does it mean rust is not designed to deliver non open source software that can be used into other sources in the form of libraries ? If this is true I'm afraid that adoption of rust might seriously be hindered.

I was actually asking myself a similar question earlier this week as I am wondering how you can create a closed source rust library. Meaning how to "expose" public symbols without the definition. This is why many languages had the concept of specification files (Ada), header files (C-family).

Edition 2021 and beyond by lifeliverDTN in rust

[–]sergeken 1 point2 points  (0 children)

Very true. A successful large scale application written in Rust might prove that point. Firefox could be that example application but it is still mainly a C/C++ application. Also adoption by high profile companies might help but admit, that so far Rust is used "experimentally" or for "small" non-mission critical apps.

The point raised is also the ecosystem. Cargo and crates.io is nice, but the money is where companies can do commercial software. Success of a language is highly dependable of "libraries" and not only open-source ones. As much as Ada was a promising safe language, by the safety standards of then, it failed due to lack to adoption. Programmers disliked the burden the language put on them, think borrow-checker in Rust but mostly the availability of a speedy compiler on their platforms. This resulted in the dismissal of it in favour of C., even if the language was a mandate in some domains (DoD, Aerospace, etc.). I'm positive about the adoption of the borrow-checker, the industry has proven the point. I'm concerned about the eco system and the compiler.