Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There might be reasons to use `bc` like this if you don't know the type of `age` and it could be a non-numeric string. Buuuuut a programming language where a simple integer-comparison leads to two subprocesses is going to be slower than the slowest existing programming languages, by orders of magnitude.


Right. And the check/type validation shouldn't happen on comparison, but on assignment and only if it is dynamically assigned.


Am I missing something, like `bc` can parse `one + two`?

Input sanitizing should be done before trying to hand inputs over to be summed.


The amber source of that is [here](https://docs.amber-lang.com/basic_syntax/basic_syntax) and contains:

    // Define variables
    let name = "John"
    let age = 30
    
    // Display a greeting
    echo "Hello, my name is {name}"
    
    // Perform conditional checks
    if age < 18 {
        echo "I'm not an adult yet"
    } else {
        echo "I'm an adult"
    }
So there is no input, everything is known statically. No sanitation required. Any additional checks done by amber in the bash code is unnecessary.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: