HNHacker News
TopNewBestAskShowJobs

mrathi12

95 karma · joined September 20, 2018

submissionscomments
mrathi12··on Object-Oriented Programming in C (2019) [pdf]
This is such a common fallacy. C exposes lower-level memory management, but to then say "oh now you have pointers you can implement anything" is a push.

If you need to implement virtual tables and function pointers, you'd use C++ - there's no need to reinvent the wheel.

Besides software engineering is about focusing on the intrinsic complexity, and using languages and tools to mitigate the incidental complexity.

mrathi12··on Object-Oriented Programming in C (2019) [pdf]
> C lets you use OO if you want it

Tenuous - if you are willing to implement objects yourself then you could use C sure, but I don't think that means the language "lets you use OO". It's like you could also probably implement algebraic datatypes in C using unions and structs, but would that mean "C lets you use algebraic datatypes"? I would strongly argue no.

mrathi12··on Writing Well-Documented Code – Learn from Examples
Agreed, I think that the code itself should be readable through better names, with the comments being a bonus rather than critical to the understanding of the code.
mrathi12··on Data Transfer Project by Apple, Facebook, Google, Microsoft, etc.
DTP tackles Article 20 of GDPR
mrathi12··on Ask HN: What startup/technology is on your 'to watch' list?
WASM is definitely one to look out for.
mrathi12··on A Complete Guide to LLVM for Programming Language Creators
While we're here, let's not forget about the incredible Kaleidoscope tutorial. They really helped me get a grip with LLVM.

https://llvm.org/docs/tutorial/index.html

mrathi12··on A Complete Guide to LLVM for Programming Language Creators
Hi, author of the post here. Thank you very much for your kind words!
mrathi12··on A Complete Guide to LLVM for Programming Language Creators
Yes, exactly. Clang emitted IR especially has a lot of (C/C++)-specific junk. If you look past that clutter, it's not too bad.

I think the best way to learn to read IR is to look at super-minimal examples, and then you'll be able to tell which parts of larger IR files are relevant.

mrathi12··on A Complete Guide to LLVM for Programming Language Creators
The command to use is `clang -S -emit-llvm -O1 foo.c`

It'll write it out to a foo.ll file.

(I use -O1 so it cleans up a bit of the messy parts of the IR).

mrathi12··on A Complete Guide to LLVM for Programming Language Creators
> learn to write little C programs and use clang to emit the IR.

Highly recommend this. I used this to get an understanding of how to implement the IR for my language.

mrathi12··on A Complete Guide to LLVM for Programming Language Creators
Regarding this post in particular, I chose to document everything in terms of the C++ API as that's the native API. You can use any of the other bindings, and just translate the syntax across to your language.
mrathi12··on A Complete Guide to LLVM for Programming Language Creators
Hey, author of the post here. Do I think the C++ API is important? For most languages no. The OCaml bindings in my case were almost sufficient, but I planned to do some memory fences and other operations in my language that the OCaml bindings didn't have.

In hindsight, it's probs better to choose OCaml bindings and then link in any special instructions you need from C++ if you need to.

mrathi12··on [dead]
Hey, Author here. This post is just some of the advice I picked up along the way. What advice would you give interns and junior developers starting out in the industry?
mrathi12··on LLVM for Programming Language Creators
Author here. Let me know if you have any questions about the guide to LLVM. Happy to answer questions!
mrathi12··on An accessible introduction to type theory and implementing a type-checker
Author here! Feel free to ask questions about the post :)
mrathi12··on An accessible introduction to type theory and implementing a type-checker
Ah, yes I have, apologies! Will repost with the correct link :)
mrathi12··on An accessible introduction to type theory and implementing a type-checker
Hey all, author here, happy to answer any questions you have!
mrathi12··on Show HN: Bolt: A research language with finer-grained concurrency than Rust
This is all unsafe code under the hood though - the ownership type system doesn't technically allow it but to increase expressivity they do provide this split() method for programmers to use
mrathi12··on Show HN: Bolt: A research language with finer-grained concurrency than Rust
> Also, Bolt runs on the JVM and thus has a garbage collector

No, Bolt targets LLVM IR

As for your other points, whilst there are escape hatches in Rust that do let you do it, it's not in the core ownership type system. That's what is being compared - the type systems.

The escape hatches mean you lose some of the guarantees the type system gives you - Bolt's approach still gives you the guarantees. That's the difference.

mrathi12··on What it's like to intern at Facebook in 2019
In response to your comment, Facebook merely gave a talk, they did not refer anyone - I applied online without a referral.

This post is about what the internship itself was like, not how to apply - there are plenty of other posts about that online.

mrathi12··on What it's like to intern at Facebook in 2019
It's coming round to internship interviewing season again, so for those considering interning at Facebook, here's a post that will hopefully give you a better insight of what it is like to intern at Facebook! I thoroughly enjoyed my internship this summer and would strongly recommend interning here - in fact I'll be returning next summer for another internship!
mrathi12··on Coding 2.0: Why bother testing your code?
I think getting into the habit of testing and good code style will pay dividends. Most test frameworks are very similar across languages so I'd say learn multiple languages and try to test your code as you do so.