Readit News logoReadit News
aaron-lebo commented on Fat pointers in C using libcello   libcello.org/learn/a-fat-... · Posted by u/dgellow
artemonster · 6 years ago
Do you, by chance, know where else object model of Piumarta is used? I think the Per6 VM "Potion" used it too as a base, but I am unsure
aaron-lebo · 6 years ago
Unfortunately, no, your info about Perl 6 is news to me. Only ran into it a few months ago, tried it in Python and Nim, but haven't seen it in the wild. It's very cool though.
aaron-lebo commented on Fat pointers in C using libcello   libcello.org/learn/a-fat-... · Posted by u/dgellow
eqvinox · 6 years ago
In my personal experience, "a bit more than a pointer" works best as a pair of (start, end) pointers (where "end" points to just beyond the last element.) The most obvious reasons for this are:

- slices become a total non-issue since a pair of (start, end) already is a slice and you can just move start and end.

- comparing against an end pointer is generally easier than adding up a length value first, particularly if you're slicing at the same time.

- the end pointer value is independent of the array element type, so if you e.g. cast to uint8_t * (which arguably you shouldn't in most cases) it stays exactly the same. If you store a count you need to adjust a multiplier. If you store a byte length, you need to do a lot of divides or casts to deal with pointer arithmetics.

Also, this is a huge red flag to me:

https://github.com/orangeduck/Cello/blob/master/include/Cell...

  #define is ==
  #define isnt !=
  #define not !
  #define and &&
  #define or ||
  #define in ,

P.S.: This also is a "try to invent a new programming language without inventing a new programming language" thing. Have your cake and eat it... either it's C or it isn't, and this library is leaving the space of "normal" C.

aaron-lebo · 6 years ago
I'll admit I've never written more than small programs in C, but the criticism that this "isn't C" isn't a fair criticism to me. He's not doing anything more than any other library can do, were he to write a compiler that mapped directly to really boring C, would it be more or less C than this? I don't feel like those questions are useful. We need experiments like this, and for me personally, cello was a revelation when it was posted here years ago. There are no rules that say you can't do it.

I know he's doing a little hackiness by placing the size before the start of the object, but they also take that approach here (https://www.piumarta.com/software/cola/objmodel2.pdf) so maybe it's not that uncommon. How would you do the dual pointer setup? Is there any overhead from that, or is it small enough to not worry about?

aaron-lebo commented on How we use Rust in our mobile SDK   bionic.fullstory.com/rust... · Posted by u/nfriedly
mlindner · 6 years ago
> Rust absolutely does not have the ergonomics of any of those languages because it has lifetimes. They are things you don't worry about in those languages.

You have to worry about them in any non-garbage collected language. There's just no compiler that checks that you're doing it correctly and is the primary source of security bugs for most software.

aaron-lebo · 6 years ago
Understood. To be specific, they said Rust has the ergonomics of Python, Go, and Java, which are garbage collected languages. It does not strike me as realistic.
aaron-lebo commented on Millions of Americans can't afford food, rent and other basics, report finds   cbsnews.com/news/american... · Posted by u/hhs
aaron-lebo · 6 years ago
Goes without saying, but it is shocking how quickly the world has changed. The easy take would be that a lot of people are finding out how the other half lives, without easy access to healthcare or using credit cards to pay bills, but the poorer are disproportionately affected.

The only positive, if there is one, is the ability to really consider how our societies operate, how dangerous apathy and incompetence are and for tech workers more specifically, to realize how much of an impact our work has.

The next time someone wants to act like they know what the future looks like, remind them to have some humility. Be safe yall. This too shall pass.

aaron-lebo commented on How we use Rust in our mobile SDK   bionic.fullstory.com/rust... · Posted by u/nfriedly
echelon · 6 years ago
> I admit that I don't have more than a passing familiarity with Nim. Rust certainly isn't the only language targeting this niche nowadays

Don't let the Nim folks fool you. Nim isn't targeting the same space as Rust. It's garbage collected.

Nim could see success in challenging Python or Golang, but Rust is rather uniquely positioned to go after bare metal (C, C++), yet have the ergonomics one would expect from Java, Python, Go, etc.

Rust is going to eat everything.

aaron-lebo · 6 years ago
Rust absolutely does not have the ergonomics of any of those languages because it has lifetimes. They are things you don't worry about in those languages.

Have you done a lot of Rust? I spent considerable time in Rust, and at the end of the day, after stepping away from it, I've found multiple options with the kind of ergonomics that make development a lot more productive for me.

Rust is not going to eat everything. I'd bet money on it. Rust will likely un quietly behind the scenes powering lots of great projects, but its audience is limited. I think HN really has a weak spot for understanding how few people even know what it is. I was surprised to ask a CS grad student that's done lots of machine learning about Rust, and he simply didn't know it existed. I like Rust and all that it taught me, but we need to be realistic about its ceiling and what it is appropriate for.

aaron-lebo commented on How we use Rust in our mobile SDK   bionic.fullstory.com/rust... · Posted by u/nfriedly
sergiotapia · 6 years ago
chicken and egg problem. Nim is a viable alternative to Rust, Python programmers feel right at home, compiles to C, and you can use any C library out there.

Nim's performance is also ridiculously fast and low memory.

aaron-lebo · 6 years ago
Not to advocate for one language over another, but sergio, you're right, Nim is ridiculously underrated and a much easier to use than rust. There's just a lot less mental overhead in almost anything and iteration is going to be much faster because lifetimes do get in the way.

Unfortunately this is one of those things where hype has kind of won out and I think a lot of people are dismissing an option like Nim simply because we're not talking about it on places like HN. Though, to be fair to Rust, the community is doing a lot of bleeding edge stuff that Nim's community just isn't big enough to.

Deleted Comment

aaron-lebo commented on How coffee became a modern necessity   wsj.com/articles/how-coff... · Posted by u/heshiebee
sandworm101 · 6 years ago
Same is true of amphetamines. US Fighter pilots were taking them as recently as 2002. I heard an interesting story about Elvis on NPR. He took two things from his time in the military: Karate, which colored his dance moves, and drugs. He got fat after coming back from the military, after he stopped the amphetamines.

https://en.wikipedia.org/wiki/History_and_culture_of_substit...

aaron-lebo · 6 years ago
If you really want to get into this, Nazi Germany and Hitler were more or less fueled by meth.

https://www.amazon.com/Blitzed-Drugs-Germany-Norman-Ohler/dp...

aaron-lebo commented on The San Francisco Bay Area shelter-in-place order is being extended through May   sfmayor.org/article/joint... · Posted by u/tdhoot
Mehdi2277 · 6 years ago
I know that for my oklahoma college friends they often had rent around 250/month for a room in the oklahoma city metro area (norman specifically). 200/month in some small oklahoma town is probably doable for a room.
aaron-lebo · 6 years ago
It's been a decade, but a friend in a college town just north of Dallas had an off campus apt for $300 a month. I had an off campus apt much closer to everything for under $500, similarly a friend even closer had an apt for $500.

The prices are a lot cheaper in a lot of US metros than the tech centers.

aaron-lebo commented on Build institutions, not apps   marklutter.com/post/build... · Posted by u/Mlutter
Ididntdothis · 6 years ago
If you don’t know how to do something you can’t just get on with it. You have to strategize. I myself have a tendency towards depression and don’t really know how it is to just to be happy. Especially after failing a few times you either give up or you start strategizing how to do it. It s a crazy cycle.
aaron-lebo · 6 years ago
Those that don't know what it is like to not be naturally happy in many cases may not understand how easy it is to get intoa bad headspace, and how vitally important it is to take the correct steps to prevent it. It is life-threatening stuff and even when it is not, it is disabling, hence the strategy.

u/aaron-lebo

KarmaCake day5159July 13, 2012
About
Computer programmer, political science PhD student, proud Texan.

@aaron_lebo

http://lebo.io

View Original