Better HN
topnewbestaskshowjobs
Log inSign up

halflife

982 karma · joined Oct 9, 2020 (6y ago) · 405 submissions

Submissions

comment 1d ago · link · parent

Can you share an explanation about breaking sandbox? If you run Claude inside a container, how would it escape?

comment 1d ago · link · parent

I don’t get it why companies think we care so much about their branding. Same thing with naming Ai agents.

comment 1w ago · link · parent

Not really, it will be a very dumb sort, you just place the item at an array index, so you can’t have duplicate numbers or negative

comment 1w ago · link · parent

replace the settimeout with a stack and you have an efficient stack sort?

comment 1w ago · link · parent

I was joking, I guess the intention didn’t pass though the text :/

comment 1w ago · link · parent

Are your apples half cylinders? Or is your pie 2 dimensional?

comment 1w ago · link · parent

So your moral high ground is to eliminate a state of 10 million people.

comment 1w ago · link · parent

Lebanon attacked Israel unprovoked on Oct 8th 2023.

comment 1w ago · link · parent

This is my system prompt

comment 1w ago · link · parent

Eat and procreate

comment 1w ago · link · parent

Probably that 1 is a divine number, and all other numbers are inferior.

Or it’s just humans project meaning into a meaningless universe.

comment 1w ago · link · parent

I just used Claude opus 5 high to refactor our permissions model to an hierarchical one. In the validation function, if a part of a permission grant was missing in the hierarchy, claude happily granted them approval instead of rejecting, fail open for permissions.

Always review the code an LLM creates.

(When I told Claude that this is very bad, its reply was “Good catch!”)

comment 1w ago · link · parent

How long until someone in Reddit points out at asphyxiation hazard, fire hazard, and the fact that the plane used to transport dangerous chemicals?

comment 2w ago · link · parent

Finally.

This is exactly what I need when I need it. The amount of pull requests I reviewed with a mess of codes that can be switched to 2 lines of modern features made me write such tools myself, only half assed since I have other things to do.

comment 2w ago · link · parent

There are many reasons why JSX is popular, react being the biggest one, where subsequent frameworks wanted to leverage people’s knowledge.

However angular, svelte, vue and more have a specific DSL for templating.

comment 2w ago · link · parent

In my suggestion I demonstrated a theoretical approach to how I think JSX shouldve been done.

JSX eventually is not a templating engine, it’s just sugar over createComponent/createElement functions, and thats its downside, we are creating html components that need templates to render.

comment 2w ago · link · parent

I may have mixed between expression and statement, however in JSX {} must return exactly 1 expression, so that limits the amount of code you can place there.

Your'e missing the point arguing about semantics of components or JSX elements, the point is that if you want to avoid control flow via expressions, you must destruct you template (however simple it may be) into tiny template fragments that makes it harder to understand the complete rendered picture.

Imaging if JSX could look like this:

  <div class="container">
    My list
    @for(item in list) {
      <h2>{item.name}</h2>
      @if(item.loading){
        <p>Loading...</p>
      } @else if (item.error) {
        <p>Error loading item</p> 
      } @else {
        <p>{item.description}</p>
      }
    }
   </div>
This is much easier than the suggested JSX approach:

  const renderItem = (item) => {
    if(item.loading){
      return <p>Loading...</p>
    } else if (item.error) {
     return <p>Error loading item</p>
    }
    return <p>{item.description}</p>
   }

  const renderList = (list) => {
    return list.map(item => {
     return <>
      <h2>{item.name}</h2>
      {renderItem(item)}
     </>
    })
   }
  
  return <div class="container">
    My list
    {renderList(list)}
   </div>

comment 2w ago · link · parent

Yes, it simplifies the engine, at the cost of developer experience. Like useMemo, that now is compiled in automatically with the new react compiler.

comment 2w ago · link · parent

I know WHY it’s not possible, but that’s a design limitation of the parser being templating on top of JS, instead of a separate DSL with escape hatches for JS, like most other templating engines

comment 2w ago · link · parent

I’m not talking about complex logic. Because simple conditions, iteration or switch statements are not supported with classic control flow.

comment 2w ago · link · parent

It’s not wrong, this is a limitation of JSX, every interpolation needs to be a statement.

Ofcourse you can split every control flow into separate component and combine them together finally, but that means exactly that - that every minute condition or iteration is deferred elsewhere. And it makes the actual render result hard to understand.

comment 2w ago · link · parent

JSX is terrible because of 2 shortcomings-

1 - all logic needs to be written in 1 statement. That forces you to use nested ternaries, nullish operators, and array fns where simple workflow controls would read much better.

2 - it’s designed to render html but conflicts with JS and TS, so you can’t have a class attribute, and weird escape hatches around generic fns.

12345
14