Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

I actually prefer "goto-less alternative 2". It's more verbose, but more explicit. No magic, I know exactly what happen. If you suddenly have more functions, you should have an array of functions with a clean_up_level variable.

Of course, you probably should not have a global state that some clean up function with a side effect deals with in the first place, but it's the c linux kernel so I assume there is something I don't know.


You missed the last sentence of the comment.

Even with custom query, using escape hatch bring a lot to the table because you benefit from the ORM core handling system for configuration, serialization, pooling, etc.

Not to mention some core (like sqla core) in fact include a functional query language that is capable of representing low level sql in any form. In which case you benefit even more, and you can do your report perfectly.


> You missed the last sentence of the comment

I didn't, and I agree with the comment. I'm elaborating upon it.


So now you need to know two languages to access the database. :-/


Unless you access the database only and don't have the reports accessed through an end-user application, you usually have some language involved to call your SQL queries, normalize input, abstract them away, etc.

You do have to learn an additional API, but as a programmer, that's something I have to do every day anyway.


At the very least you should know SQL. The purpose of having a query dsl in some other language isn't to avoid understanding sql, it's because sql isn't easily composable.


CTEs. Views. Set-returning functions.

"SQL isn't easily composable" is a pernicious lie. Does it compose like your favorite functional language? No.

SQL is not nor has ever been a functional or object-oriented or generic or procedural language. It's a fourth-generation declarative set-oriented language, so the composability is going to be based on sets. Period.

Until you think of SQL as a set-oriented declarative language, you will be perpetually trying to push water uphill, ORM or no.


It's not a pernicious lie at all. You can't just say, it's composable so long as you only compose with the special mentality that you consider to be blessed. Also the fact that SQL acts on sets is completely irrelevant to the syntax being composable or not. JSON is programmatically composable. XML is programmatically composable. S-expressions are programmatically composable. Most programming language syntax's are not.

If you build a UI or reporting mechanism that wraps around an SQL engine and has multiple configuration options that combine to determine the SQL expression that should be used, the fact of the matter is that you will either abstract the combination of the configuration into a DSL that then gets converted to SQL, or you will have a mess of string concatenation that isn't type-safe and isn't verifiably correct until runtime.

Show me the code you'd write to generate an SQL expression with ten optional filters, where each filter is comparing a different column to a set, and if the set is empty the filter should be ignored. I'll show you a DSL that does the same thing, is readable and statically verifiable, and ensures that if anybody else ever writes a similar query guarantee's that parameters will be the same so that the execution plan can be cached.


S-Expressions are not a set-based construct. Neither is JSON nor XML. Those are all document-oriented and/or hierarchical tree structures.

I did not "bless" SQL as a set-based language. It's literally a 4th generation, declarative DSL for set theory. That was its design goal. That's the lens through which every change to the language and the engines that implement it are discussed and adopted.

If I said LISP sucked at object-oriented programming and OO design patterns, how would you react? How about if they said LISP shouldn't be solely through the lens of functional programming just because that's your "blessed mentality" for it.

I don't even know how to respond to that assertion. "It's not even wrong."


I would probably say that you are miss-understanding the difference between syntax and the evaluator that evaluates that syntax.

All three of these expressions contain the same data:

(select (col1 col2) (table1) (= col1 "foo"))

"select col1 col2 from table1 where col1 = 'foo'"

<select><columns><column>col1</column><column>col2</column></columns><tables><table>table1</table></tables><filters><equalityfilter><column>col1</column><value>foo</value></equalityfilter></filters></select>

All three of these are "4th generation, declarative DSLs for set theory" as you like to brandish around.

> If I said LISP sucked at object-oriented programming and OO design patterns, how would you react? How about if they said LISP shouldn't be solely through the lens of functional programming just because that's your "blessed mentality" for it.

S-Expressions are just a syntax. It's quite normal to see Lisps that are functional, declarative, object-oriented or procedural. The only thing that differentiates Lisps from other programming language is the simplicity of the syntax enabling meta-programming, which is specifically the problem with SQL syntax and it's composability.


JSON, and XML are data structures, not programming languages. Can you loop or iterate in JSON or does some other language do the iterating? Can XML execute instructions (without a script tag or processing instruction, which is just punting to an external 3rd-gen language)? S-Expressions blur the line a bit, but clearly not in the direction of 4GL.

A 4th-gen language is specifically one that describes what you want, not how to get it. S-Expressions fail this metric in that they can describe the logic for retrieval in addition to the data (where the data portion is not conducive to it being a programming language).

    SELECT a.id
         , a.name
         , p.name
      FROM alien a
      JOIN planet p ON a.planet = p.id
     WHERE a.name = 'Kaminoan'
    ;
Now here I'd completely agree that things might have been better with some non-implicit syntax bounds, eg.:

    SELECT [ a.id
           , a.name
           , p.name
           ]
      FROM [ alien a ]
      JOIN [ planet p, (a.planet = p.id) ]
     WHERE [ a.name = 'Kaminoan' ]
    ;
As it stands today, SQL has some pretty gnarly EBNR to describe it. But that is still missing the point. Where are the datasets for "alien" and "planet"? Are they on the same disk? The same server? The same cluster? The same kind of database?

Are there a lot of aliens? Would a btree index lookup be more appropriate, a sequential search, a bloom index, or some other algorithm? Is alien name enforced to be unique or not so that we can be sure to return either optional one, exactly one, zero or more, or one or more?

Is "planet" a single table, a view into one or more tables, a materialized view that caches its results, or a foreign table accessing the data from another source that isn't even relational?

A 3rd-gen language would need to know these things. It would require telling the system HOW to get the data rather than just describing WHAT data subsets are desired based on other known data sets. It doesn't just transform one or more sets into a new set without any consideration as to what serialization format those data sets are stored in—on disk or in memory.

Here we have the need for separation between DDL and DML. Yet DDL still only describes the structure and makes access patterns available. Creating an index does not mandate use of that index. It merely puts that data access pattern on the menu. DML (as seen above) makes the query result set definition but has nothing to do with telling the engine how it should go about doing it.

Ergo: 4th-gen declarative language

This doesn't mean SQL is the best language or even better than all 3rd-gen languages simply because it's a 4th-gen language. But if you're going to engage in this topic, I strongly encourage you to learn what a 4th-gen language actually is and how laughable calling JSON, XML, or S-Expressions one is.

I could give you HTML as a 4th-gen language in that it describes layout and general behavior without reference to how the layout engine renders it or implements its linking, form-handling, and embedding behavior. HTML+CSS make a compelling case for a composite 4th-gen language, describing what you want, not how to render it. Whether it be links, Firefox, or Mobile Safari, the description is the same and the desired behavior is well-defined despite wildly different implementations from the engines.


I keep replying to you by the way because I'm really hoping you are going to have the aha moment that is holding you back here. Again, you are misunderstanding the difference between syntax and how it is used. Json and xml aren't data structures. They are syntaxes, which are commonly serialised into a data structure. (Usally a tree). S-expressions are also syntaxes that can be parsed into a data structure.

Did you know that C# is also a syntax that can be parsed into a data structure? The Roslyn compiler does this, which allows for symbolic code manipulation and generation.

Did you know that's how almost every programming language parser works? They will tokenise a syntax into a symbolic data structure which will then either be interpreted and executed or output a binary. You can quite easily write a parser for xml that uses it as a programming language. Two well known examples of this include xslt and xhtml. Xhtml is even one of your lauded 4th gen declarative languages.

Whether or not the language is popular enough to have multiple parsers isn't relevant to the class of language that it is. In the example of a c++ program that reads xml into a tree, and then converts that xml into sql to be executed on a database, that xml syntax has become a 4th gen domain specific language.

The important distinction between languages and data structures is the the implementation of the parser/evaluator and what it does with the text or symbols that it reads. A language implies execution and a datastruture implies serialisation.


Oh come on. You are basically arguing that Python is just syntax, not a programming language; it's just the interpreter that parses the text and makes it go. No duh! You've made a distinction without a difference.

If an XML dialect were to be parsed by a processor to declaratively perform a sequence of tasks, the AST is not relevant to this discussion, only the tasks being performed. The XML dialect—the semantic structure behind it—is what I'm discussing.

JSON and XML as they are used today are "just syntax", but they are examples of syntax that almost universally are parsed directly into data structures. The Liquibase XML dialect on the other hand moves beyond a simple data structure into a declarative language for migrating database structures from one form to another by virtue of the Liquibase engine.

SQL is not "just syntax" any more than your speech is "just phonemes". Yes, English, Xhosa, and Mandarin are all just collections of phonemes. All written languages are "just syntax" waiting to be processed by smart meat.

It is needlessly reductive.

SQL absolutely implies execution in a way that JSON/XML do not. However, the style of execution is clearly different between SQL and C#. That style can accurately be described as set-oriented execution, at a higher level than 3rd-gen languages such as Python or C#.

Writing a parser for SQL (or XHTML) is a very different exercise from processing the AST from that parsed SQL/XHTML if that processing happens immediately after the parsing step and is largely driven by that AST.

Relational database engines are interpreters for SQL.


But these are actually for different purposes and requirements. KISS and DRY are respected.


Can confirm. My .email is regularly reject even by my own country administration.


Yes, but it's necessary.

Because just be yourself works well in Disney movies, but IRL, we have social norms and many reward/punishment systems depending on how much and often you deviate from them.

So you have to find a balance between being genuine and fitting in. Everybody does, but for some of us, it's more costly. Usually, the balance is achieved by having different groups in which you can adjust the cursor differently, like work, friends and family, if you are lucky.


There's a difference between adaptation (you do your best to fit in, knowing yourself, but you accept your difference) and camouflaging (imply you're afraid of how you look to others, so this is paralysing you, it creates anxiety, etc..)


When you are on the spectrum, no, there isn't.

It's not about you. It's about others. And a lot of it about what things appear, not what they are.

That's not shocking to an autist. That's factual.

We don't mind factual, we mind intent.

Just like I don't mind what you state, I do mind the virtue signaling it attempts.


That difference is self-confidence, and it's both foolish and disingenuous to label all people that have lacked self-confidence at some point as autistic.


Everyone who camouflages once expressed themselves to the world.


Except when it comes to bullying. Apparently bullies can be themselves all they want and they get supported because reasons.


In school yes, because it's a very peculiar microcosm. Outside it varies a lot.


If you have to own a specific device to exist administratively, I'd rather use something that:

- doesn't cost hundred of dollars

- doesn't live track me every seconds

- isn't holding also the rest of my entire life

- isn't a good target for stealing, ceasing or hacking

The wonderful thing about the payment card is that it's just that: a payment card.

It's small, cheap to replace, doesn't require a battery, doesn't share my GPS position at every second, can't show me ads, and if it gets stolen, I don't also lose my entire list of contacts and my browser favorites.

I can easily have many in my pocket, and only use one when I want. If I lose it, I can cancel it quickly, it doesn't affect anything else, and it's swiftly replaced.

It's also super simple to use, yet not that easy to abuse.

The phone is already too many things at once. Too many eggs on the same baskets.


Contrarian opinion: I’m never going back to using a card now that I’m used to paying with my phone. I always have my phone with me anyway. Paying with it is perfect. I don’t even carry a wallet anymore. Plus, things are frictionless. Changing card is easy. It’s fast and doesn’t require a pin most of the time.

I have been moving more and more things to my smartphone as time goes on. It’s already my 2FA anyway so it will be a major hassle if it’s stolen (but stealing modern smartphone is useless as they can’t be reactivated anyway).


We used to have a little key ring fob that would display a number that would change from time to time. That +password was all we needed.

If my phone breaks, I can’t get onto my work network now…


Yes, a government or corporate issued device like a Yubikey with NFC is my ideal. Just tap to the phone to verify. Payment cards got it right, everyone else is just catching up.


In eat the same food amount than my friends, but make a lot more money. 25% vat on pasta means nothing to me. Heck, I don't even look at food price.

But it means a lot to some of my friends with minimal wage.


If someone went to set your house on fire, empty your bank account and kill your family, I'm pretty sure "your life wasn't destroyed nor hurt in anyway. It just changed" would not be well accepted by you.


Also, how does the local biome react to it? Mushrooms and insects have strong symbiosis trees after all.

And as usual for complex systemw, wa don't have a way to reliably model the outcome at scale.

But again as usual, instead of taking precautions and testing this in isolation for 30 years, humans deploy in production.


I have 3 keys. One on my keychain in my pocket, on in my bagpack, on at home. The chance of loosing all of them are really slim.


> The chance of loosing all of them are really slim.

True, but you sacrificed some safety for that. If you're not home, you can only create accounts protected by the keys in your person, and you're one robber (or fall into a pool) away from losing those accounts.

I'd never accept a password manager with such limited sync, and those are usually free. Paying for three hardware keys and still having such limitations is beyond me.

I'm all for hardware keys, and I'd love to use them to replace all my passwords, but I still wouldn't call your setup "adequate" in terms of either cost, friction, or safety.


How often do you create new accounts at FIDO-supporting sites? You must have a different internet usage model than I do.

You can also add the additional keys later. If it's a serious enough account to be protecting with hardware keys, and you only have a couple keys with you, add a note in your password manager to remind you to add your other FIDO keys. You could add that note to the username so you can't login without editing the username and acknowledging it.

It sounds like a non-issue you're turning into a hypothetical concern because... I don't know, you don't like paying a quite modest amount of money for increased security?

Falling into some water won't brick a yubikey anyway.


> How often do you create new accounts at FIDO-supporting sites? You must have a different internet usage model than I do.

It’s introducing one more frustrating make-work item for the human. Now I have to remember to enroll all my keys at all the sites I’ve used them for. Totally manual. Totally forgettable.

These keys should act like HSMs and have proper backup and restore. Even if it locked me into a specific key manufacturer (like lost HSM backup/restore functionality does) I’d take that over the idiotic “just have multiple keys and manage keeping them all enrolled manually” story.


Probably the most important feature of hardware tokens is they can't be copied.

Any backup is a copy.


Here's an example of what I consider a reasonable hardware key security model:

I can initialize a Nitrokey HSM on a disconnected PC with whatever device key encryption key (DKEK) I want (128-bit AES key). I can write that key down and store it in a safe place (broken into chunks, if need be, for my security model). I can backup my keys generated by the Nitrokey to export files that are completely useless w/o my DKEK. I can store those backups wherever I want without any loss of security.

If I lose my Nitrokey device I can buy another, initialize it with the same DKEK, and restore my key backups. (If I really want to I can decrypt my backups using my DKEK.)

If I don’t want to do any of that I can have the Nitrokey generate a random DKEK that is never exposed. Then I lose all my keys permanently when I lose the key. I have the option to choose the model that allows me to backup my keys if I want to.

If the point of the hardware key is to put the owner thru pointless make-work and risk then the hardware key is serving somebody other than the owner.


No. The backups have their own secrets and no relationship to one another. You register them as distinct keys with each app.


> If you're not home, you can only create accounts protected by the keys in your person

I'm not often creating many accounts away from home, and I'm not often then away from home for long periods of time where this matters. I'm also just not often creating that many accounts.

If I'm out someplace and I need to create an account but don't have all my authenticators, I'll either just go without 2FA for that brief period of time or just go with the authenticators I have with me. Then when I'm home (probably within a few hours) I'll add those extra authenticators.


I also use a password manager. Yukikeys are a poor choice for authentication despite what the article says.

But they are good for 2FA, which is what I need them for to mitigate the risk of phishing, siphoning credentials from my phone or just stupidity on my part.

A robber would still need the password so I'm safe for my threat model, which doesn't include state actors.

But you are right about one thing: adding those keys to all the important account, and adding a new one when you lose one, is a pain in the butt.


Ideally people should be able to understand sentence from anyone without them trying to craft in a way that works for the person.

But they don't.


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

Search: