dgentile's comments

dgentile | 5 years ago | on: Git's list of banned C functions

Edited: Looks like they have safe alternatives: "

  - strlcpy() if you really just need a truncated but
    NUL-terminated string (we provide a compat version, so
    it's always available)

  - xsnprintf() if you're sure that what you're copying
    should fit

  - strbuf or xstrfmt() if you need to handle
    arbitrary-length heap-allocated strings
"

dgentile | 5 years ago | on: Computer Science Curriculum in 1000 YouTube Videos

I think starting with a language with static typing would be better. With Python or Javascript you still need to know how the types work otherwise you can run into unexpected "defined behavior". Something like Golang makes a fair compromise between C and Python: it is statically typed, compiled, and has a garbage collector.

dgentile | 5 years ago | on: Computer Science Curriculum in 1000 YouTube Videos

C++ is really nice for low-level OOP, and compared with C it adds generics and classes. Compared to Python, C++ is lower-level and can have significant performance gains with a well written program. With regard to Julia, if you write your code in "the right way", it is also compiled and low-level.

dgentile | 5 years ago | on: Parse, don’t type-check

The problem is that fundamentally we always have types. We must define different types of bytes and the different things we can do with those bytes. If you can generate a binary from your programming language, it must use a form of static or inferred typing to know what assembly code to generate. A dynamic language just checks at runtime, and adds a bunch of overhead, which isn't always necessary, and is more likely to result in weird "defined" behavior like we get from javascript and php. Typescript is very popular because you can make certain guarantees at compile time, instead of a vague hand-wave of "the code looks good".

As an example of the benefits of type-checking, in the Vulkan api, there are a lot of handles. VkRenderPass, VkPipeline, VkSwapchain, VkDevice, etc. All of these are just pointers. If we take a function like:

    void vkDestroyCommandPool(VkDevice,VkCommandPool,const VkAllocationCallbacks*);`
And remove the type checking:

    void vkDestroyCommandPool(void*,void*,const void*);
It is the same API, but without type-checking. Even if the parameters are labelled, with this new API I could mess up and pass the wrong thing.

dgentile | 5 years ago | on: My daughter was a creative genius, and then we bought her an iPhone

This exactly. That she's returning home from school at 6:30! The author didn't give their daughter's age, but we can assume it's right before 14, so maybe 12-13. I'm in high school, and I take a couple HL IB classes, school always gets out for me at 3, and then I do cross country until 5. That is already a long day. Then I go home, eat, do homework, and depending on the workload it could be anywhere between 8:00-12:00. Finally I'm able to go to bed, and redo the whole thing. I am a high schooler, and I'm taking high level classes for credits in college. The author's daughter is probably a middle schooler.

The issue is the daughter doesn't have time to be creative. I program, edit videos, etc., but all of that I have to save for the weekends. The daughter probably doesn't have the energy to be creative and just uses their phone during some downtime.

With my generation we are not always on our phones like many would believe. Pre-covid we would gather and talk after school, during lunch, in class. If I went with my friends to lunch it is acceptable to check your phone but we would never find it acceptable to be on your phone the whole time.

The issue is probably not the daughter, but the workload.

dgentile | 5 years ago | on: Free Software Is More Reliable (2011)

Free Software is amazing. I love emacs, Firefox, bash, zsh, nginx, postgres, llvm, linux, freebsd, and many other packages. But, I think that there are two points to be made with regard to commercial software.

1: Domain specific programs, and polish. Logic Pro X, Final Cut Pro X, Ableton, Cubase, Premier Pro, are are excellent pieces of software that people pay for and use every day. Where is the free software equivalent that isn't glitchy and has a usable, slick, ui? The more specific the case gets, and the less related to systems a Free Software project is, the less likely it is to exist or have any polish. I can list Postgres, Redis, Linux, OpenBSD, NetBSD, NodeJS, WebKit, SpiderMonkey, LLVM, GCC, Binutils, Busybox, etc., but where is the free software iMessage, Google Docs, Discord, iTunes, Steam, Google Maps, etc. There may be some of these projects out there for what I just listed, but none of them have a userbase as big as that proprietary software. The only things I can think of are VLC, Blender, and Android.

2: Free Software can only exist with Commercial Software. How many people that work in Free Software are software engineers working at a corporation? What pays for this Free Software to exist? Microsoft hosts github, big enough Free Software projects have budgets and employees at other companies paying for all of it.

dgentile | 5 years ago | on: When You Get into Unschooling, It’s Almost Like a Religion

High Schooler here. I've been teaching myself Vulkan and am writing a videogame, but I'm so exhausted on weekdays from my course-load that I only work on it on weekends and breaks. I wish I could put more time into it but trying to program after 6+ hours of school and then homework is a nightmare, and that code usually ends up being buggier than my normal output, with low productivity.

dgentile | 5 years ago | on: Make LLVM Fast Again

The Rust is 10% slower metric I think is unfair. If you look on godbolt, the LLVM IR that rustc emits isn't that great, so LLVM has to take some extra time to optimize that, compared to the output of clang.

dgentile | 5 years ago | on: Some overwhelmed parents are abandoning at-home schooling

HS student here. Our district made the decision to keep grades, or you can apply to drop distance learning if you meet certain circumstances. This is incredibly frustrating for me since 1) I can't slack off and work on my C++ projects ;) and 2) It's a ridiculous amount of work, and some teachers are not exactly being fair. Our school has the IB program, and I am in the "Precalculus" class before HL Math 1. The teacher is a bad teacher anyway in school, and yet out of school they are worse. We are given instruction in these obscure note packets that are basically a list of formulas. Every single time I need to solve the online problems we are given, I end up on Wikipedia, or Khan Academy... so why am I taking this class?

In other classes, the teachers don't seem to grok that we have other classes, and instead will give us one "trivial 1 hour" assignment a day.

I'm starting to feel burnt out, unlike during actual school which was manageable for me. I would rather we were given an assignment or two a week in each class, or shorter assignments each day. (Thankfully two of my teachers get this)

Also, google classroom can be frustrating if the teacher doesn't use it well. Let's say they post a couple announcements a day, along with assignments, and there was a project assigned on Monday. I have to go hunting to see if there was something. It gets buried in a big stack, and sometimes it will just up and surprise me on Friday when it pops up as "Due today". This I blame more on google than the teachers, since I think there should be a way to visually represent the assignments that isn't a twitter feed.

dgentile | 5 years ago | on: Eloquent JavaScript 3rd Edition (2018)

My point was more along the lines of the code bloat that comes from essentially emulating a web browser on system, when in reality you can write much faster code in C/C++ or even C#/Java. But, GUI design for applications can be a nightmare, with QT on the one hand versus fragmented Cocoa/Windows Whatever in C#.

I think Electron was the webdev community's response to this, and we really haven't gotten one on the app/systems developer side besides QT.

Or to rephrase, using Electron to "emulate" a web browser is cross-platform from the perspective of the electron user, while most other gui-ing solutions in C/C++, are not necessarily cross-platform, and therefore this leads to different set of challenges.

dgentile | 5 years ago | on: Eloquent JavaScript 3rd Edition (2018)

I disagree. Headless code on a single server can still be very difficult. For instance, nginx, mariadb, etc, which allow the frontend to function well, are difficult to write. You have to deal with multiple threads, search algorithms, handling tcp/udp requests, and optimizing all of that so it isn't dead slow. Whereas writing GUI in JS/React involves less "computer science" complexity and more compatibility complexity-dealing with things like, what is the screen-size, the locale, etc.

On the note of the HN's perceived hatred of JS, I think its because Javascript has tried to do too many things. Despite its quirks I like Javascript in the context of the web browser, but what I dislike it that it exists in applications and on the server side. The Atom editor should not take up 200 MB and take forever to boot. But it does because instead of taking the time (like sublime text) to write a rockstar system code, they instead used electron. The feeling I get sometimes is that JS developers want to program the same way they do in the browser, everywhere.

page 1