TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Q – A Data Language

220 pointsby miloshadzicabout 11 years ago

18 comments

koloronabout 11 years ago
That&#x27;s at least the third programming language named Q:<p><a href="https://en.wikipedia.org/wiki/Q_(programming_language_from_Kx_Systems)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Q_(programming_language_from_K...</a><p><a href="https://en.wikipedia.org/wiki/Q_(equational_programming_language)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Q_(equational_programming_lang...</a>
评论 #7333608 未加载
评论 #7333573 未加载
评论 #7333524 未加载
评论 #7334010 未加载
评论 #7338881 未加载
评论 #7334367 未加载
lkrubnerabout 11 years ago
I am surprised that EDN is not making more progress as a data interchange format, especially now that it has fantastic validators and coercion libraries, such as Prismatic&#x27;s Schema:<p><a href="https://github.com/prismatic/schema" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;prismatic&#x2F;schema</a><p>This is, by far, the most intelligent data exchange system I have ever seen. It offers a richer language of types than what is offered by JSON, it is as readable as YAML, it is far more concise than XML. And yet it seems unable to break out of the world of Clojure. But it deserves to be taken seriously as a data interchange language.
评论 #7335691 未加载
skrebbelabout 11 years ago
I really like this. In general, a well-supported non-crappy schema language for modern data exchange formats is long overdue (e.g. JSON Schema is horribly un-human-friendly). The fact that they aim higher and allow for a much more detailed set of validations is great, IMO.<p>I hope that this becomes a success and gets implementations in many programming languages.
评论 #7333743 未加载
评论 #7335295 未加载
评论 #7337107 未加载
评论 #7337696 未加载
anonuabout 11 years ago
I got excited at first - I thought they were referring to the Q language from KDB. This reminds me quite a bit of Google&#x27;s protocol buffers.
评论 #7333931 未加载
mercurialabout 11 years ago
A &quot;data language&quot;, in this context, is a language for representing and validating data. I&#x27;m not clear on why it&#x27;s called &quot;Q&quot;, or why it calls marshalling&#x2F;unmarshalling undressing&#x2F;dressing. The language itself looks alright, it&#x27;s dependently typed. It doesn&#x27;t say anything about the speed of the existing JS&#x2F;Ruby implementations.
评论 #7336208 未加载
telabout 11 years ago
It&#x27;s strange to me how dependent Q becomes on its host language. Instead of defining its own types in order to sit between various serializations and host systems, Q seems to simply augment the Host with a few extra types.
评论 #7334714 未加载
islonabout 11 years ago
In Clojure you can use schema (<a href="https://github.com/Prismatic/schema" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Prismatic&#x2F;schema</a>) which does the same thing without needing a separate language.
评论 #7334041 未加载
hipsters_uniteabout 11 years ago
This is the second project named &#x27;Q&#x27; that&#x27;s been on HN in the last week or so. All cool ideas, but some Googling first by all parties would probably ease confusion.[0]<p>[0]<a href="https://news.ycombinator.com/item?id=7290655" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7290655</a>
tincoabout 11 years ago
It&#x27;s interesting, but is it powerful enough? There&#x27;s a great talk by Zed Shaw about implementing authorization code. I think the same issue holds here.<p>A language might work for simple and more complex type constraints, but at some point the constraints might become so weird that you really need a full blown turing complete language to define them.<p>And that point might be sooner than you&#x27;d like. Why not instead of using expressions in this constrained language, use something like Haskell?<p>It&#x27;s got the super powerful typesystem, and you&#x27;re certain that it will be able to express <i>any</i> constraint you throw at it.<p>That said, this language does look nice, and I haven&#x27;t really tried to find out if there&#x27;s any obviously important constraints you wouldn&#x27;t be able to build in it.
评论 #7333728 未加载
评论 #7333645 未加载
评论 #7333762 未加载
评论 #7333691 未加载
评论 #7333655 未加载
评论 #7336101 未加载
bjourneabout 11 years ago
Given that you use a powerful rdbms, such as postgres, you don&#x27;t need anything more than sql constraints. For example, the constraint to check the temperature would be something like CHECK(temp between 33.0 and 45.0). To check that no two user accounts share the same alias, a simple UNIQUE(user_alias) will do. More complex constraints can be enforced using plpgsql.<p>Then name your constraints. Then when the sql layer throws them, it&#x27;s trivial to remap them to user readable error messages. It works especially well in newer postgres versions where the error reporting is much more detailed and the messages easily machine parsable.
评论 #7338931 未加载
snorkelabout 11 years ago
I like it because you can practically use this to define a grammar for parsing a programming language, because:<p>1. Each data type can inline express its own value constraints (not just type constraints, but rather value constraints) which is key to source code parsing<p>2. With subclasssing you can combine data types into higher level objects that inherit all of the lower level value constraints. This is similar to how a recursive lexer drills down from a high level statement into the different parts of each statement.<p>3. The data type value constraints support sequences, alternatives, and unions, most of what a lexer needs to parse a language based on a grammar spec<p>With these ingredients you can actually parse code, and thereby write a code interpreter (or parser at least). You begin with a grammar rule (a high level data type) that defines a statement, and a statement is defined as a list of alternatives forms of a statement, and each statement form is defined as a sequence of keywords and supported value types, and so on down the language primitives.<p>... but I&#x27;m not sure if supports recursion, and thereby recursive descent parsing. Can you say something like &quot;Sum = [Sum, Operand, Sum]&quot; If not then you&#x27;re limited to immediate values only and no nested expressions.
nevi-meabout 11 years ago
Am I missing something fundamental here? I think in the home page Q shouldn&#x27;t be compared to just JSON as they are in principle two different things. If I were to write a &#x27;data language&#x27; or to extend an existing language to cater for data, wouldn&#x27;t I write my validators in that said language? If I am correct, then I was expecting Q to be compared to the closest other &#x27;data language&#x27;, not be compared with a document&#x2F;schema.<p>For example, if I was doing it in JS, I&#x27;d say: var validDoc = true; var Temp = function (t) {return t &gt;= 33.5 &amp;&amp; t &lt;= 45.0};<p>then when I get the doc, I loop through my conditions, as such:<p>validDoc = Temp(doc.temperature);<p>&#x2F;&#x2F; reject if !validDoc<p>From here, the benefit of Q becomes that it&#x27;s much easier to do validations, instead of writing them from scratch, considering that my example above only returns a true || false, as it doesn&#x27;t have the error handling to let me know what went wrong and where.<p>One could also achieve some of what Q is doing by using an ORM if said data is going to a database&#x2F;document store.<p>So, HN, am I missing something here?
Bjoernabout 11 years ago
Interesting... here is a tool, which is also going twoards data oriented approach.<p>&quot;Drake - a kind of make for data&quot;<p><a href="http://blog.factual.com/introducing-drake-a-kind-of-make-for-data" rel="nofollow">http:&#x2F;&#x2F;blog.factual.com&#x2F;introducing-drake-a-kind-of-make-for...</a>
jdc0589about 11 years ago
I can&#x27;t count the number of times I have wanted to set up re-usable model definition and validation, but haven&#x27;t been able to find a good portable library that isn&#x27;t part of something much larger I don&#x27;t need. This definitely addresses a space in need of more options.<p>My answer was modlr (<a href="https://github.com/jdc0589/modlr" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jdc0589&#x2F;modlr</a>), which I have been ignoring, but Q looks like it could do well. I&#x27;m not super pumped about the name though, conflicts with super popular promise library lots of people already use.
评论 #7334267 未加载
baneabout 11 years ago
Oh dear, this might conflict with a SQL variant we cooked up at my old company called Q-Lang. Where you could write a SQL statement, leave bits of the WHERE clause &quot;blank&quot; and it would generate a GUI interface with drop downs and calendars and everything to let people fill in those bits without too much effort. Nothing terribly fancy, but it let you go from a working example SQL statement to an integrated query interface in the app in about 10 minutes.<p>It had lots of limitations, but most of the time it absolutely annihilated some of our competition&#x27;s multi-month integration engagements.
dj-wonkabout 11 years ago
Q is trying to do both data and validation, which are very different problem spaces. I think designing for both involves serious tradeoffs for the individual parts.
elwellabout 11 years ago
Finally a new language that does something remotely novel. I like the blur between data and code here; (very) vaguely lispy.
mrcactu5about 11 years ago
where is all the theory behind q-lang coming from? are there theoretical principles behind this new schema language?