6 ms·
It is possible to completely avoid syntax, period, by putting boxes of various colors on a whiteboard and labeling or connecting them with pictographic symbols
by logicallee 10y ago
It is possible to completely avoid syntax, period, by putting boxes of various colors on a whiteboard and labeling or connecting them with pictographic symbols representing what you want to do.
As soon as you do so you will realize that all modern programming languages are as dumb as a sack of rocks, and the functionality you are coding is trivial.
You can then design the syntax, which is what separates your language from every other dumb as a sack of rocks language.
Quick, name a language where I can do something simple like mention "Whenever this function is called, make sure there is enough free memory (at least ---- MB) before actually calling it; if there isn't, first swap out any objects from memory to disk, starting with the ones that had been used the longest time ago, and after the function has finished running, swap those back into memory."
That's pretty straight-forward and well-specified. Name a language I can do that in?
Or how about this: "analzye this library and include a logically simplified version that only needs to address these cases:" (a list of conditions.). What language will even try to simplify included source code?
Or take debugging. Name a language I can add this line to: "if variables A and B ever both change as a result of the same function call, print the following debugging message:" trivial. Name a language that can do it.
Languages are dumb. They do almost nothing. I can't wait for the future, it can't get here fast enough.
- theoh 10y agoThe specific case of pre- and post- memory management could be handled by hooks (like in emacs lisp) or automatically through an abstraction along the lines of https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization https://en.wikipedia.org/wiki/Resource_acquisition_is_initia... I'd argue that some languages have some quite powerful syntactic conventions. Pattern matching and algebraic data types are very clear and concise (and statically-checkable) ways to write code. A whiteboard can't compete in the concrete case of covering all the possibilities and proving it. There's clearly more wit in those constructs than in a simple AST, which seems to me to contradict your claim.
- coldtea 10y ago>Quick, name a language where I can do something simple like mention "Whenever this function is called, make sure there is enough free memory (at least ---- MB) before actually calling it; if there isn't, first swap out any objects from memory to disk, starting with the ones that had been used the longest time ago, and after the function has finished running, swap those back into memory." The first fallacy is thinking that this is "simple" merely because it is "well specified". The second fallacy is thinking that this should be the task of a language.
- Turing_Machine 10y ago"The second fallacy is thinking that this should be the task of a language." Yes. This should be the job of the OS, not the programming language.
- logicallee 10y agoIn my opinion a language should do whatever I want. And in the future languages will.
- inimino 10y agoBy the time languages have the DWIM feature, AI already took the whole job.
- logicallee 10y agoThis is very insightful. I'll let AI take the whole job, if it means it will just do whatever I want after. Small loss if that means lots of programming jobs disappear.
- coldtea 10y agoYour opinion is more about magic than computer science.
- logicallee 10y agoYou know the quote I'm going to put here :)
- logicallee 10y agoHey you're right, a language shouldn't let me just describe what my executable should do - and then give me that executable. My mistake! A language should just be a super tiny syntactic framework that elegantly lets library writers rewrite the same thing they already wrote in C++, Python, Perl, Go, Java etc libraries for - but this time in my language! It shouldn't really "do" anything. Who needs a programming language with any abilities! That's not what languages are for! /s
- AndyKelley 10y ago> Quick, name a language where I can do something simple like mention "Whenever this function is called, make sure there is enough free memory (at least ---- MB) before actually calling it; if there isn't, first swap out any objects from memory to disk, starting with the ones that had been used the longest time ago, and after the function has finished running, swap those back into memory." Can you imagine trying to debug a program that used such a language feature? What a nightmare.
- logicallee 10y agoYeah it's a lot easier to reason about languages that are as dumb as a sack of rocks - they're so well-defined! Basically just syntax. Add a bit of syntax highlighting and you know EXACTLY what's going on. Which is my point. I look forward to languages that make it trivial to do super hard stuff. If debugging them is hard, make it easy to ask them what's going on. (Also difficult today, again, because they are as dumb as a sack of rocks.) Every example I gave was super well-defined.
- webmaven 10y agoSure it is well defined, but the resulting performance of the program isn't necessarily deterministic, it will be super sensitive to whatever else is going on in the machine as well as whatever else the program is doing. Why would you want to add a syntactical feature that duplicates the services the OS is already providing and makes the performance of the program less predictable and consistent?
- al2o3cr 10y ago"I'm going to remodel my nasal cavity to accommodate a swarm of bees" is a well-defined goal - it just isn't something you'd want to do, even if you've got access to tooling that makes it straightforward.
- prymitive 10y agoQuick, name a language where I can do something simple like mention "Whenever this function is called, make sure there is enough free memory (at least ---- MB) before actually calling it; if there isn't, first swap out any objects from memory to disk, starting with the ones that had been used the longest time ago, and after the function has finished running, swap those back into memory." Why would you need a language for that? Isn't memory management what a kernel will do for you, including this specific scenario (the swap back to memory part will be done if pages are needed in memory)?
- logicallee 10y agoWhy would you need any new language? Likely anything you would want has been done in some language already. I was simply giving an example of something simple and well-specified that isn't being done. - In response to the other comment (sorry this is breaking the comment ordering, but I am going to sleep soon and triggered some submitting too much message): >And you know, the best way to get to the future is to invent the future ... Nobody is going to accuse you of being an idea man/woman if you just stand around and wait. (My original comment was downvoted to -3, though this surprised me). Meanwhile I can pick my battles (what to invent) carefully, away from the dumb as a sack of rocks status quo. Which I was just reporting a part of. Don't shoot the messenger. (But also, as a practical matter, this story is about how syntax is the last thing you should design - which I kind of disagree with.) - I also wish I had added in parentheses (in my original comment) after "pictographic symbols", the words "(or evocative post-modern landscapes that have meaning only to you, the language designer, with a brief sentence underneath each one, of the type that if you were to ever revisit it or have to explain it to anyone else you could)" in parentheses, though now that I see the backlash against my comment, it doesn't really matter. The reason I can't add those parenthetical words is because I am outside my edit window.
- webmaven 10y ago> I was simply giving an example of something simple and well-specified that isn't being done. But as has been explained elsewhere in this thread, it is being done, but either by the OS or the VM, rather than as part of the language semantics. Improvements in the explicit handling of memory allocation are both possible and desired in programming languages (eg. Rust has some interesting memory-related syntax and semantics), but this particular suggestion of yours just isn't well thought out.
- spc476 10y ago> Whenever this function is called, make sure there is enough free memory ... Lisp? Forth? Smalltalk? And that's just off the top of my head. But really, an operating system with a virtual memory system will handle that mess for you. > analzye this library and include a logically simplified version that only needs to address these cases I think SynthesisOS (an operating system, not a programming language) could pull that off to a degree (the kernel was JIT'ed and therefore, customized system calls could be developed). > if variables A and B ever both change as a result of the same function call ... I wouldn't be surprised if GDB couldn't do this. I know it can watch both reads and writes, so this should be possible. How easy is a different answer. And you know, the best way to get to the future is to invent the future ...
- vidarh 10y ago> I think SynthesisOS (an operating system, not a programming language) could pull that off to a degree (the kernel was JIT'ed and therefore, customized system calls could be developed). I keep meaning to spend more time looking at SynthesisOS [1] - it deserves more attention. The JIT'ing as a means to speed up system functions by specialising them could be useful all over the place, and I think one of the most important contributions is that it doesn't need to be done everywhere - you can specialise JIT'ing of very small portions of hot codepaths and get a lot of the benefit at very low cost. For those not familiar with Synthesis, chapter 3 of [1] is a good place for a quick summary of the techniques used. Section 3.3.1 gives concrete examples. (The old Amiga user in me is very pleased Synthesis used M68k - makes the assembler examples very nostalgic...) [1] Synthesis: An Efficient Implementation of Fundamental Operating System Services Alexia Massalin - http://valerieaurora.org/synthesis/SynthesisOS/ http://valerieaurora.org/synthesis/SynthesisOS/
- renox 10y agoIf I remember well it had no memory protection, incompatible by design so..
- klibertp 10y ago> Quick, name a language where I can do something simple like mention [...] Every single language out there is capable of doing all these things. Like, even Python fits the bill: > Whenever this function is called Use decorators to add pre and post processing to any function. > make sure there is enough free memory (at least ---- MB) Call out appropriate OS function (http://stackoverflow.com/questions/2513505/how-to-get-available-memory-c-g#2513561 http://stackoverflow.com/questions/2513505/how-to-get-availa...) via ctypes. Or use Python's own `gc` module, if you're only interested in your process' memory. > if there isn't, first swap out any objects from memory to disk Use `pickle` to serialize your objects, use advanced meta-programming to create proxies for the serialized objects which you can then use (store in dicts, list, pass to functions, etc.) which defer loading from disk until needed again in the future. Remember to initiate gc cleanup after you're done dumping things to disk. > starting with the ones that had been used the longest time ago Store access time on objects, sort by that time when serializing. > and after the function has finished running, swap those back into memory. Touch every proxy object so that it reads and unpickles the object it replaced earlier. -- So, let me repeat: every existing language lets you do all of that and more. The amount of work needed to make all these differs by language, of course, but you can do all that if you want, in any language you choose. I don't know what you're thinking. Given that the above is obvious to any competent programmer, could it be that you're a simple troll?
- logicallee 10y agoEverything you said is much more complicated than the simple directive I gave (as an example of functionality). You should not accuse others here of trolling, you can read the guidelines here: https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html Please be civil on HN. I further gave you an extremely difficult functionality, which I phrased as " 'analzye this library and include a logically simplified version that only needs to address these cases:' (a list of conditions.)". You ignored this. This is obviously not functionality any language includes. It is not easy or anything like that. If you don't like my examples, you can come up with your own. Pick something hard that programming languages don't do. You are correct that most programming languages have most of the same functionality, and differ only in their syntax: this was my point. For this reason there are transpilers (source to source compilers) which output a different language. If you don't like my examples, pick your own. Anyway in this comment I have already quoted myself saying such an example, which you ignored. My overall point is that most languages don't strive for such features. They most markedly just differ in syntax. You confirmed this at the top of your comment. Thanks for your additional thought, and please remember to be civil.