Live data from Hacker News

Edit is now open source

devblogs.microsoft.com

91–100 of 191 posts

Re: Edit is now open source

#92
post #50

Earlier quoted context omitted.

I’m guessing this isn’t just to optimize for binary size. If you have the resources to avoid third party dependencies you eliminate the burden of having to build a trust case for the third party supply chain. That is the number one reason we sometimes reimplement things instead of using third party packages where I work: the risk from dependencies along with the effort required to establish that we can trust them is…

Microsoft has recently said AI writes 30% of their code. Reimplementing things isn’t as expensive as it once was.

[dead]

Re: Edit is now open source

#93
post #48

Earlier quoted context omitted.

Since windows 10/windows server 2019 afaik. https://news.ycombinator.com/item?id=15904265

Thanks! It always bugged me that Windows didn't have a sshd, since it's so popular outside of Windows. I thought the reason for it not being added would be admitting a failure somewhere - RDP not winning or something. Seemed odd to prevent a way into Windows Server.

No. It was a fundamental conceptual difference in the operating system. After Xenix, Microsoft did not use a terminal paradigm in its operating systems. They all had a "console" paradigm, where instead directly attached VDUs, keyboards, and mice had explicit API support as first-class devices. Because they targetted "personal computers" where one knew from the firmware up that the machine had a VDU, a keyboard, and (possibly) a mouse.

* https://jdebp.uk/FGA/tui-console-and-terminal-paradigms.html

For a long time, so long that I had a widely used 2 decades old Frequently Given Answer about it, Windows NT had no way to capture console I/O, no way of waiting on consoles for buffer changes and to inject back-end input events. No way to do what a SSH server would need to do in order to capture and send/receive that I/O over a network.

Then along came Windows Terminal, and I finally got to change the answer in 2018.

* https://jdebp.uk/FGA/capture-console-win32.html

Re: Edit is now open source

#94
post #53

Hey all! I made this! I really hope you like it and if you don't, please open an issue: https://github.com/microsoft/edit To respond to some of the questions or those parts I personally find interesting: The custom TUI library is so that I can write a plugin model around a C ABI. Existing TUI frameworks that I found and were popular usually didn't map well to plain C. Others were just too large. The arena allocator e…

The quirkiness of Zig is real. I'd love for Zig to win out but it's just too weird, and it's not progressing in a consistent direction. I can appreciate you falling back to Rust.

Re: Edit is now open source

#95
post #63

Earlier quoted context omitted.

It's such a simple program that it's better to roll a proprietary program that is well integrated with windows You can use nano over wsl if you want

> You can use nano over wsl if you want No, not when ssh'ing to a server to manage it. Pulling in a Linux VM to get a simple text editor also makes no sense. There is also nothing to integrate - it's a basic text editor for a terminal with no fancy features. It either edits text or it doesn't.

you gotta make sure that hotkeys get passed in every keyboard configuration. Ctrl, CTRL Shift, Ctrl Caps, Alt, how do tabs work? Etc..

That something looks simple but is actually difficult is an error we all make

Re: Edit is now open source

#96
post #89

Earlier quoted context omitted.

Why not webassembly ABI?

I'm not familiar with that, so I can't say. If you have any links on that topic, I'd appreciate it. Generally speaking, the requirement on my end is that whatever we use is as minimal as it gets: Minimal binary size overhead and minimal performance overhead. It also needs to be cross-platform of course. This for instance precludes the widely used WinRT ABI that's being used nowadays on Windows.

Maybe something like https://www.codecentric.de/en/knowledge-hub/blog/plug-in-arc... ?

Webassembly is the binary spec for the web. But now everyone is using that because it's portable and lightweight.

The idea is you can create plugin using any language that compiles into webassembly. C, Rust, Pascal, Go, C++. Compile once and it should work in Windows, Linux and Mac. No need to compile to multiple architecture.

Performance should be great near native, but I guess there's going to be a problem with the added webassembly runtime size. Here is a runtime with estimated sizes: https://github.com/bytecodealliance/wasm-micro-runtime

And it's sandboxed too, so should be secure.

Re: Edit is now open source

#97

I have to say, I really miss MS-DOS TUI apps like edit, the qbasic editor, and xtree-gold. The linux-terminal based ones just seem a bit off in comparison. Maybe it's mouse and keyboard support in terminals (shift-enter support, anyone?) aren't great? People have different aesthetics? I don't know... Next stop: VS-EDIT would be pretty cool :) (This with LSPs)

It's definitely for that reason. It is amazingly hard to portably do something as trivial in the DOS world as recognize [Shift]+[Ins]. The terminal paradigm is very different to the console paradigm in some areas.

In the days when a Tektronix terminal was a real physical thing that one sat in front of, the TUIs that one used didn't look at all like the ones in the contemporary personal computer world. Ironically, an old Tektronix or DEC VT user transported into the future would be very at ease with what you get in the Linux-based operating system world today.

All that said, the Windows Terminal people have worked pretty hard to get even some of the obscure ECMA-48, ITU T-416, DEC VT, and XTerm stuff into Windows Terminal, so at least TUI applications writers who are prepared to write all of the bizarre hooplah to have things like recognition of [Control]+[Home] and correctly operating reverse video, actually will get them.

Re: Edit is now open source

#98
post #89

Earlier quoted context omitted.

I'm not familiar with that, so I can't say. If you have any links on that topic, I'd appreciate it. Generally speaking, the requirement on my end is that whatever we use is as minimal as it gets: Minimal binary size overhead and minimal performance overhead. It also needs to be cross-platform of course. This for instance precludes the widely used WinRT ABI that's being used nowadays on Windows.

Maybe something like https://www.codecentric.de/en/knowledge-hub/blog/plug-in-arc... ? Webassembly is the binary spec for the web. But now everyone is using that because it's portable and lightweight. The idea is you can create plugin using any language that compiles into webassembly. C, Rust, Pascal, Go, C++. Compile once and it should work in Windows, Linux and Mac. No need to compile to multiple architecture. Perf…

And I guess forcing FFI for plugins is going to be a headache for many plugin authors.

Re: Edit is now open source

#99
post #76
post #67

Earlier quoted context omitted.

1. What do you like about Zig more than Rust? 2. How did you ensure your Zig/C memory was freed properly? 3. What do you not like about Rust?

> What do you like about Zig more than Rust? It's been quite a while now, but: - Great allocator support - Comptime is better than macros - Better interop with C - In the context of the editor, raw byte slices work way better than validated strings (i.e. `str` in Rust) even for things I know are valid UTF8 - Constructing structs with .{} is neat - Try/catch is kind of neat (try blocks in Rust will make this roughly e…

The design intent of unsafe Rust is that its usage should be rare and well-encapsulated, but supported in any domain. Alleviating a performance bottleneck is a fine reason to use unsafe, as long as it only appears at the site of the bottleneck and doesn't unnecessarily leak into the rest of the codebase.

The most basic reason why you can't have unrestricted mutable aliasing is because then the following code, which contains a use-after-free bug, would be legal:

    let mut val = Some("Hello".to_owned());
    let outer_mut = &mut val;
    let inner_mut = val.as_mut().unwrap();
    *outer_mut = None;
    println!("{}", inner_mut);
If, as is sometimes the case, you need some kind of mutable aliasing in your program, the intended solution is to use an interior-mutability API (which under the hood causes LLVM's noalias attribute to be omitted). Which one to use depends on the precise details of your use case; some (e.g., RefCell) carry performance costs, while others (e.g., Cell) are zero-cost but work only for certain types or access patterns. Having to figure this out is annoying, but such is the price of memory safety without runtime garbage collection. In the worst-case scenario you can use UnsafeCell, which as the name suggests is unsafe, but works with any type with no performance cost. UnsafeCell is also a little bit heavy on boilerplate/syntactic salt, which people used to C sometimes find annoying; there isn't that much drive to fix this because, as per above, it's supposed to be rarely used.

The "few percent in benchmarks" thing sounds like it's referring to the rule that it's UB to use unsafe code to make aliased &mut references even if you don't actually use those references in a problematic way. Lifting that rule would preclude certain compiler optimizations, and as per above would not fix the real problem; you still couldn't have unrestricted mutable aliasing. It would only alleviate the verbosity cost, and that could be done in a different way without the performance cost (like by adding special concise syntax for UnsafeCell) if it were deemed important enough.

The uninitialized-memory situation is pretty widely agreed to be unsatisfactory. Unfortunately it is hard to fix. Ideally the compiler would do flow-control analysis so that you can read from memory that was uninitialized only if it has definitely been written to since then. Unfortunately this would be a big complicated difficult-to-implement type system feature, and the need to make it unwind-safe (analogous to the concept of exception safety in C++) adds much, much more complication and difficulty on top of that. You could imagine an intermediate solution, wherein reading from uninitialized memory gets you a valid-but-unspecified value of the applicable type instead of UB, but that also has some difficulties, such as unsoundness in conjunction with MADV_FREE; see https://internals.rust-lang.org/t/freeze-maybeuninit-t-maybe... if you're curious for more details.

Again, the point here is not "the current design is optimal", it's "improving on the current design is a difficult engineering problem that no one has solved yet".

I think people who need cursors over linked lists use a third-party library from crates.io for this, but it's quite reasonable to think that the standard library should have this. Most of the time when a smallish feature like that remains unstable it's because nobody has cared enough about it to shepherd it through the stabilization process (perhaps because it's not a hard blocker if you can use the third-party library instead). Possibly that process is too slow and heavyweight, but of course enacting a big process change in a massively multiplayer engineering project that's governed by consensus is an even harder problem.

Re: Edit is now open source

#100
post #55

Is there anything in EDIT.EXE for MS-DOS that inherently hinders porting to x64? I wish they have implemented the same color theme as well.

There is no EDIT.EXE. If you have an EDIT.EXE you probably need to check for malware. (-:

It was EDIT.COM, and in the days of long ago that was just a way of invoking QBASIC with the /EDIT command-line option. At which point the project becomes one of porting an old MS-DOS full programming IDE to 64-bit Windows, just for its text editor part.

Also, much of MS-DOS was written in 16-bit 8086 assembly language; so porting MS-DOS programs is not a mere matter of compiling a high level language with a compiler that targets the new platform and processor architecture and tweaking whatever breaks.

Post reply on HN