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.

Gravity: a new programming language and VM written in C

269 pointsby marcobambiniabout 8 years ago

24 comments

dualogyabout 8 years ago
Quite promising: clean-looking syntax, little overhead, portability seem to be driving motivations. Especially the following feature could promise adoption and momentum:<p><pre><code> dynamic typing (not a fan myself, but for scripting: OK --- would be great if all such languages had a statically&amp;strong-typed option --- after all the compiler&#x2F;JIT needs to guess&#x2F;work much less) higher order functions and classes coroutines (via fibers) closures garbage collection operator overriding powerful embedding api </code></pre> Very neat-<i>sounding</i>. Will have to keep watch. Not as low-level as Go (<i>can</i> become wordy!), not as &quot;foreign&quot; initially as Rust (what, no GC, borrowing, a borrow checker, what?), not (yet!) as &quot;haphazard&quot; as... the <i>majority</i> of shell-scripting&#x2F;server-scripting&#x2F;client&#x2F;web-scripting approaches.
评论 #13807509 未加载
评论 #13808784 未加载
chchabout 8 years ago
For a short moment, I hoped that this was about a revival of one of my favorite non-Turing-computable esoteric programming languages, but I guess that&#x27;s of pretty low probability!<p>Unfortunately the original spec is long gone, but [1] at least mentions the gist:<p>[1] <a href="https:&#x2F;&#x2F;esolangs.org&#x2F;wiki&#x2F;Gravity" rel="nofollow">https:&#x2F;&#x2F;esolangs.org&#x2F;wiki&#x2F;Gravity</a>
weberc2about 8 years ago
How does the feature set differ from [Wren][0]? Also, the syntax reminds me a lot of Go.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;munificent&#x2F;wren" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;munificent&#x2F;wren</a>
marcomsabout 8 years ago
What&#x27;s the argument for required brackets around if (conditions) and switch (conditions)? To me they seem redundant.<p>--<p>As a side point, I hope switch statements are less like C and more like Rust (Rust happens to have better looking syntax, not just because its Rust):<p><pre><code> match &lt;identifier&gt; { &lt;val&gt; =&gt; { &#x2F;&#x2F; } .. } </code></pre> C-style always creates confusion on how to indent blocks following case statements
评论 #13805691 未加载
评论 #13806002 未加载
评论 #13804919 未加载
评论 #13806056 未加载
bpicoloabout 8 years ago
Says it supports Functional programming, but I don&#x27;t really see functional features. Seems premature?<p>I see what the goals of Gravity are, but are there any reasons I want to use it?<p>Side note: not a huge fan of implicit self, i.e. class methods automatically referring to &quot;y&quot; as the instance variable &quot;y&quot;. I realize c# and Java do it, but worrying about name elision at all is something I&#x27;m not a fan of. From an ergonomics perspective, it makes editor autocomplete features slightly worse, as a prefixed &quot;this&quot; or what have you can give it additional context vs &quot;anything in scope&quot;
评论 #13803620 未加载
评论 #13803784 未加载
评论 #13803527 未加载
JCDenton2052about 8 years ago
What problem does it solve that is not solved already? What does it do better than it is done today?
评论 #13805823 未加载
评论 #13805185 未加载
Entangledabout 8 years ago
Wouldn&#x27;t this be better served with defaults?<p><pre><code> &#x2F;&#x2F; constructor func init (a, b, c) { if (!a) a = 0; if (!b) b = 0; if (!c) c = 0; x = a; y = b; z = c; } </code></pre> Like<p><pre><code> func init (a=0, b=0, c=0) { x = a; y = b; z = c; }</code></pre>
评论 #13804907 未加载
评论 #13808264 未加载
d--babout 8 years ago
Has anyone tried this CreoLab thing? Any comment?<p>Here&#x27;s the main use case: <a href="http:&#x2F;&#x2F;creolabs.com&#x2F;gravity" rel="nofollow">http:&#x2F;&#x2F;creolabs.com&#x2F;gravity</a>
评论 #13804532 未加载
评论 #13806268 未加载
评论 #13808084 未加载
geofftabout 8 years ago
This looks like a language designed for use with a commercial product &#x2F; development environment (<a href="http:&#x2F;&#x2F;creolabs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;creolabs.com&#x2F;</a>).<p>I&#x27;m curious how well that works - I know that <i>used</i> to be fairly common in the &#x27;80s and &#x27;90s, but it feels like that hasn&#x27;t been happening much of late. The only very similar examples I can think of are Swift and Xamarin; Swift had the advantage of a large customer base (everyone writing iOS apps), and Xamarin was based on an existing, well-established language (C#). And all the older big examples that come to mind, VB, Delphi, Objective-C, etc., were variants of an existing language (Basic, Pascal, C, respectively), not a brand new language.<p>Creo folks, are you finding that customers &#x2F; potential customers are excited about picking up the new language? I&#x27;d love to live in a world where there&#x27;s more work on programming languages (clearly, none of our existing languages are optimal) but I&#x27;m not super optimistic.
seibeljabout 8 years ago
Cross-platform embeddable VM language written in C for iOS and Android? Strange, I&#x27;ve been doing this for years using Lua...
评论 #13804241 未加载
评论 #13804347 未加载
评论 #13804762 未加载
pkdabout 8 years ago
I think the main value of this project is hidden under the &quot;internals&quot; link of the site. It discusses the construction of the language. Although it is incomplete as of now - hopefully the pages get filled up.<p><a href="https:&#x2F;&#x2F;marcobambini.github.io&#x2F;gravity&#x2F;internals&#x2F;" rel="nofollow">https:&#x2F;&#x2F;marcobambini.github.io&#x2F;gravity&#x2F;internals&#x2F;</a>
kibwenabout 8 years ago
<i>&gt; Swift-like syntax</i><p>But the example doesn&#x27;t show any Swift-like syntax... except for `func`. Other than that, this is a dead ringer for Javascript.
andrewmcwattersabout 8 years ago
I&#x27;m totally biased since I love Lua and C, but this language looks great. Really loving what it&#x27;s putting down.<p>Edit: What&#x27;s downvote worthy of this comment?
评论 #13806029 未加载
评论 #13803879 未加载
评论 #13805444 未加载
jlebrechabout 8 years ago
I&#x27;ve been looking for an embeddable language other than Lua to use in an ncurses app.
gctabout 8 years ago
How&#x27;s performance compared to eg: Python?
评论 #13806206 未加载
anilgulechaabout 8 years ago
&#x2F;&#x2F; a represents a range with values 1,2,3 var a = 1...3;<p>&#x2F;&#x2F; b represents a range with values 1,2 var b = 1..&lt;3;<p>Ah! I wish they had gone for 1..3 and 1&gt;..3 and 1..&lt;3 and 1&gt;..&lt;3 to make it easy to understand. The above would map to [1,2,3], [2,3], [1,2] and [2] respectively.<p>Range operator quirks with ... and .. have to today be memorized and waste developer seconds that add up to man-years.
评论 #13808874 未加载
anintegerabout 8 years ago
It looks nice but... How do you call into existing C libraries? I didn&#x27;t see an example of that.
评论 #13803888 未加载
amaiabout 8 years ago
I like <a href="https:&#x2F;&#x2F;nim-lang.org" rel="nofollow">https:&#x2F;&#x2F;nim-lang.org</a> more.
scott_karanaabout 8 years ago
Any details about the runtime (or lack thereof)?
traviswingoabout 8 years ago
For those being negative about &quot;yet another programming language,&quot; try creating a lang sometime...it&#x27;s a fantastic exercise and, in the very least, will make you a much better programmer.
评论 #13804023 未加载
评论 #13803908 未加载
评论 #13803614 未加载
评论 #13803608 未加载
评论 #13803974 未加载
eternalbanabout 8 years ago
Well, they have an excellent 404 page: <a href="http:&#x2F;&#x2F;creolabs.com&#x2F;404.html" rel="nofollow">http:&#x2F;&#x2F;creolabs.com&#x2F;404.html</a>
pavfarbabout 8 years ago
&quot;built-in JSON serializer&#x2F;deserializer&quot; near &quot;closures&quot; and &quot;coroutines (via fibers)&quot; feels a bit.. odd. Sign of the times, I understand, but still.<p>Apart from this boring grumbling, the project is very interesting. Waiting for internals (<a href="https:&#x2F;&#x2F;marcobambini.github.io&#x2F;gravity&#x2F;internals&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;marcobambini.github.io&#x2F;gravity&#x2F;internals&#x2F;index.html</a>) to arrive.
评论 #13806293 未加载
hubert123about 8 years ago
It looks good, but no word on performance numbers or debugger or IDE.
snackaiabout 8 years ago
Great, just what we needed, another programming language.
评论 #13803573 未加载