Hacker Newsnew | past | comments | ask | show | jobs | submit | more localhostdotdev's commentslogin

reddit's code formatting is its own story, it supports both 4 spaces and triple backticks (but only on redesign web).

> On redesign, a slightly-edited version of CommonMark. On old reddit, it's still snudown.

(and mobile apps have their own markdown)

> New Reddit note: Indented code blocks are the only form of code block that works on Old Reddit. Use them for compatibility

https://www.reddit.com/wiki/markdown#wiki_code_blocks_and_in...

maybe in a few years there is going to be syntax highlighting, one can hope :) (slack doesn't have it either, but even discord has it...)


I did some investigation into this recently. My hope is to make at least new reddit support it this year. Can't promise anything about old.reddit.com though


"every other system has a feature except us, and we are not going to add it (because reasons) even if it's very widely used"

also:

> When a fork syscall is made on WSL, lxss.sys does some of the initial work to prepare for copying the process. It then calls internal NT APIs to create the process with the correct semantics and create a thread in the process with an identical register context. Finally, it does some additional work to complete copying the process and resumes the new process so it can begin executing.

https://blogs.msdn.microsoft.com/wsl/2016/06/08/wsl-system-c...


They must have considered it many times (not least when making the partial posix support for NT) but felt that supporting it wouldn’t help deprecating it either.

AFAIK it’s only unix/Linux (posix) OSes that implement fork. Perhaps that’s what you meant by “every other system”, ie unix + clones/derivatives?


Also DRI's FlexOS 2.2 had it, it was not a unix clone per-se.

The COMMAND SVC had/has 4 variants:

- Execute program (akin to posix_spawn)

- Chain program (akin to posix_spawn, and parent exit)

- Execute subprocess (start a thread, one supplies code + stack address)

- Execute fork process (ala fork, but one supplies code + stack address like with 'subprocess' above)

Originally it only had the first two forms, 2.1 added the subprocess form, 2.2 added the fork form.

It didn't have a direct equivalent to exec(), but did have an OVERLAY SVC which loaded fresh code in to the process, and I expect that could be used to make something like exec(). Not that I ever tried, given there was no real need for it.

The other way to create an exec() like behaviour would have been with the CONTROL SVC, akin to ptrace(), but that would have been painful to do.


VAX/VMS implement "vfork()" which is an implementation of the most common use-cases of fork.

VAX and VMS are not POSIX or UNIX-like.


VAX is a hardware architecture. I'm not one to nitpick, but differentiating between VAX and VMS when VMS ran on the VAX is confusing.


On their POSIX compatibility layer.


blocks are the same as passing a function or a lambda in python:

    [1, 2, 3].map { |i| i + 1 }

    [i + 1 for i in [1, 2, 3]]

    def plus(i):
      return i + 1

    map(plus, [1, 2, 3])

    map(lambda i: i + 1, [1, 2, 3])


Far from it. Ruby blocks aren't really lambdas or anonymous functions. For example when you use return inside a block, it's not just the code in the block is being returned, but the whole enclosing function. And, you don't really "call" a block but yield to it. It's not even an object that you can inspect. It's syntax. It's really a new kind of control structure. Ruby blocks have few equivalents in other languages.


   def f(&block)
     block.class
   end

   f { } # => Proc
   f(&-> { }) # => Proc
   f(&lambda { }) # => Proc
   f(&:something) # => Proc

   lambda { }.class # => Proc (I think you get the idea)

   method(:f).class # => Method

   lambda { |i| i + 1 }.call(10) # => 11
you don't typically return in a block, there is implicit return. you would do "next" or "break" depending on what you want to achieve. as far as I know that's the main difference between procs and methods.

(not that anybody would do what I do, most people just use blocks, some people use yield, few people use the &block argument, but that's exactly the same)


Sound a lot like inlined lambdas in Kotlin. Lambdas can be passed with the same block-like syntax, and when they're marked as "inline" you can return from the enclosing function from within the lambda (because the lambda will have its body inlined by the compiler).


github uses libgit2 https://github.com/libgit2/libgit2 (in C) but I'm pretty sure they have a lot of wrappers around it (maybe a ruby gem with native extensions, maybe using ffi)

edit: ruby gem: https://github.com/libgit2/rugged which has a native extension written in C to bind libgit2 functions to ruby methods.


if you go through the files in the repo they are very easy to read (I would recommend starting with the test/ folder): https://github.com/jcoglan/jit

obviously the lib folder requires a lot of git-specific knowledge but I didn't see any use of features that don't have exact or very similar equivalent in more popular programming languages.

I think the most "complex" might be things like Struct.new(*Inputs::ATTRS) where it's creating a new anonymous class from a list of attributes which becomes the class instance attributes (nothing crazy :) )


the linked repository is amazing, I don't think I ever saw such nice code and such neat organization: https://github.com/jcoglan/jit (everything uses standard ruby libraries or default gems like minitest)

I'm trying it out and doesn't work very well on macOS (git add has issue with the lockfile, but all tests pass).

I might use it as it's a very easily customizable implementation of git.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: