Live data from Hacker News

Sylph: the programming language I want

eev.ee

111–119 of 119 posts

Re: Sylph: the programming language I want

#111

Earlier quoted context omitted.

What's effortless is putting begin and end of blocks symbols only where they matter. Haskell is particularly guilty of creating several different indenting possibilities, and does require constant intervention. Python is less bad, but still requires more effort than C for example.

Er… you know Haskell's syntax is defined as braces-and-semicolons right? And the braceless-and-semicolons-free syntax is the addition of a few layout rules[0] for human convenience. [0] https://www.haskell.org/onlinereport/syntax-iso.html#sect9.3

Yes, I know that. Currently I'm having a better result using parenthesis instead to completely escaping from the semantic blank lines. It's cleaner than using semicolons everywhere.

Anyway, Haskell is a very instructive example about how semantic indentation creates problems.

Re: Sylph: the programming language I want

#112
post #13

Earlier quoted context omitted.

> The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly. Nonsense. Try pasting a block of Python into Hacker News and you get something that starts off like this: import os import random def do_something(x): if x: fd = os.open(x) and only gets worse. A language with braces/semicolons has no such problem;…

> A language with braces/semicolons has no such problem; it is easier to communicate with others If someone posts more than two lines of practically any curly-brace language as one line, it's illegible. Yes, you can pull it into an editor and fix it automatically, but it's a huge waste of time that is best fixed by simply posting the code properly in the first place.

"If someone posts more than two lines of practically any curly-brace language as one line, it's illegible." "...you can pull it into an editor ... but it's a huge waste of time..."

Well, I know it may sound a little bit awkward, but sometimes I just want it to see it work before looking into it, and copy-pasting curly-braced kind of code is perfect for that. So the curly-braced style solves a lot of such inside content distortions and actually frees me from a huge waste of time.

Re: Sylph: the programming language I want

#113
post #69

The lang I want would be mixture of C, C++, Go, Rust, Julia, JavaScript 6, PHP 7, Swift, Lua. * Optional typing (like PHP7/Hack/ES7) * support for compilation (statically linked native binaries) and JIT (like Visual Basic 6 with its P-Code) * memory safety (no null/dangling pointers like Rust) * procedural & object oriented & functional style (like JavaScript/PHP/C++) * modern base standard library / API (like C/Go/J…

You might want to check out Dart (https://www.dartlang.org)

* Optional types

* The VM compiles source into machine code on the fly, or you can embed the VM into your app.

* No pointers.

* Core library is full-featured (https://api.dartlang.org/apidocs/channels/stable/dartdoc-vie...)

* Third-party libs and packages in https://pub.dartlang.org

* Docs at api.dartlang.org and www.dartdocs.org

* Debugger works in Eclipse, IntelliJ, WebStorm

* Works in Win, Mac, Linux, 32 and 64 bit.

* Also runs on ARM and MIPs

* Isolates for memory-safe concurrency

* Async primitives like Future, Stream, and async/await

(disclaimer: I'm a PM on the Dart team)

Re: Sylph: the programming language I want

#114
post #97
post #94

Earlier quoted context omitted.

What types does the following function expect for the arguments a and b, and what type does it return? What should an IDE tell the user about the types of a and b in the completion popup? function foo(a, b) { return a + b; }

In some static languages, the inferred type for a and b could be Numeric , and foo 's type could be: (Numeric, Numeric) -> Numeric Which seems good enough to me. But what if + is also String concatenation? Or any other overloading of "+". Then maybe the type of a and b is Something_that_can_be_+ed . The user can then think "ok, I'll pass a couple of Int s to obtain an Int , or a couple of String s to obtain a String…

Now consider the following buggy code:

    var price = document.querySelector('input#price').value; // "10"
    var tax = document.querySelector('input#tax').value; // "1"
    var total = foo(price, tax); // "101"
This will concatenate two strings together, even though the author intended to add two numbers. If the foo function had been annotated as numeric the IDE could have provided a warning about the incorrect types and put a squigly line under foo.

I find this type of fast feedback improves programmer productivity. It means that you get warned straight away, and don't have to do a trip through the debugger to find the problem.

Just because the compiler can infer that a specific type could be passed to a function, that does not mean that the developer intended that function to be used with that type.

Re: Sylph: the programming language I want

#115
post #107

Earlier quoted context omitted.

Editors know that a python line ending in a colon must be indented and so indent it automatically. It wouldn't be hard to use the same method to reindent it.

No, lines following a line ending in a colon must be indented. But the OP's point is that you can't know how many lines make up the indented block, since there is no explicit block-end-marker left if the indent is gone.

Yep, that's what I meant.

Re: Sylph: the programming language I want

#116

Earlier quoted context omitted.

Brainstorming is not a structured exercise, it's a bunch of people throwing ideas. How productive it was is not measured by constraints.

One of the structural features of brainstorming is the prohibition on criticism. Etc.

Etc, what?

You mean that structural features like prohibition of criticism in brainstorming leads to limited and unimaginative ideas, which is the point of brainstorming in the first place, and that no one agrees on what the the structural features of brainstorming actually are in the first place?

In any case, I don't understand your writing very well because it doesn't show a lot of clarity, but if you really wanna keep up a debate, I don't mind.

Re: Sylph: the programming language I want

#117
post #114
post #97

Earlier quoted context omitted.

In some static languages, the inferred type for a and b could be Numeric , and foo 's type could be: (Numeric, Numeric) -> Numeric Which seems good enough to me. But what if + is also String concatenation? Or any other overloading of "+". Then maybe the type of a and b is Something_that_can_be_+ed . The user can then think "ok, I'll pass a couple of Int s to obtain an Int , or a couple of String s to obtain a String…

Now consider the following buggy code: var price = document.querySelector('input#price').value; // "10" var tax = document.querySelector('input#tax').value; // "1" var total = foo(price, tax); // "101" This will concatenate two strings together, even though the author intended to add two numbers. If the foo function had been annotated as numeric the IDE could have provided a warning about the incorrect types and put…

Oh, agreed. I assumed foo was meant to be generic, i.e. useful over more types than just Int. If it was just meant to be used for Int and nothing else, it should be annotated accordingly. Otherwise the compiler, quite correctly, determines that foo is more "generally useful", which may have unintended consequences.

Re: Sylph: the programming language I want

#118
post #98
post #63

Earlier quoted context omitted.

Interesting that you use the past tense. I am using such a language in the present. And it is working just fine. I have no need for Python but so many people are seemingly trying to coax me to use it. Such is the case for most of the verbose languages. I do not understand all the constant discourse about languages. Personally I prefer to choose something simple and small, and stick to it. To increase convenience when…

What are these terse languages you speak of?

APL, J (http://www.jsoftware.com/), k (http://kparc.com/k.txt).

www.reddit.com/r/apljk/

Re: Sylph: the programming language I want

#119
post #114
post #97

Earlier quoted context omitted.

In some static languages, the inferred type for a and b could be Numeric , and foo 's type could be: (Numeric, Numeric) -> Numeric Which seems good enough to me. But what if + is also String concatenation? Or any other overloading of "+". Then maybe the type of a and b is Something_that_can_be_+ed . The user can then think "ok, I'll pass a couple of Int s to obtain an Int , or a couple of String s to obtain a String…

Now consider the following buggy code: var price = document.querySelector('input#price').value; // "10" var tax = document.querySelector('input#tax').value; // "1" var total = foo(price, tax); // "101" This will concatenate two strings together, even though the author intended to add two numbers. If the foo function had been annotated as numeric the IDE could have provided a warning about the incorrect types and put…

In this case, the issue is with using + for string concatenation, a very bad idea IMHO.
Post reply on HN