News for hackers. Stuff that matters.
Re:Lily Programming Language by tomp on Friday July 01, 2016 @09:33AM (#12015862)

    print($"My name is ^(@name).")
I don't understand why anyone would still require special notation for interpolated strings, when we have the awesome and unambiguous string interpolation syntax introduced by Swift (granted, this project was started in 2011, before Swift).

> Reference counting has the benefit of giving consistent, and more easily measured performance. There's no fear of the garbage collector suddenly leaping into action right at the worst time, or having to tune the collector to minimize pauses.

LoL. Refcounting can lead to just as long pauses as GC, if your reference is the last reference to a huge object graph.

Re:Lily Programming Language by jesserayadkins2 on Friday July 01, 2016 @09:38AM (#12015902)
To my understanding, Swift wasn't public for a long time. The idea behind requiring a special syntax for interpolation is that it's supposed to be more clear as to do you really want interpolation, or do you not actually want it. I'm :/ about the interpolation syntax right now. One thing I wanted to avoid is telling people "oh no your string never terminated."

You're right about reference counting being able to pause. But that's something you're more able to control. If you're doing game dev, you can say "I won't assign to references that might be big" during frame critical code.

With garbage collection, you're more or less "Run the gc before, hope it doesn't trigger during that critical spot." or the alternative of fiddling with the gc/manually firing it off so it doesn't stop your world when it's a bad time to stop the world.

Re:Lily Programming Language by Nullabillity on Friday July 01, 2016 @09:43AM (#12015933)
> print($"My name is ^(@name).") > > I don't understand why anyone would still require special notation for interpolated strings, when we have the awesome and unambiguous string interpolation syntax introduced by Swift (granted, this project was started in 2011, before Swift).

Why should the swift syntax be considered the default now? "My name is $blah." has been the de-facto standard for ages.

Personally I like interpolation sigils since in most cases you don't actually use it, and languages like Scala allow you to define custom sigils with custom behaviour. For example, Slick defines a sql"SELECT * FROM table WHERE username=$username" syntax that does not cause SQL injection issues.

Re:Lily Programming Language by berdario on Friday July 01, 2016 @09:44AM (#12015943)
Swift string interpolation syntax is not more awesome or any less ambiguous than other syntaxes used in other languages

In fact, it's the first time that I've seen interpolation with round parentheses, rather than curly braces (which are used in javascript with $ (es2015 template literals), python, bash with $, ruby with #, groovy with $, etc... )

> LoL. Refcounting can lead to just as long pauses as GC

He didn't say more performant, he said consistent

Re:Lily Programming Language by vorg on Friday July 01, 2016 @07:50PM (#12020542)
> I don't understand why anyone would still require special notation for interpolated strings, when we have the awesome and unambiguous string interpolation syntax introduced by Swift

You're both wrong. String interpolation is just a very thin syntactic layer. It's easy enough to write

  printf("Half of %f is: %f5.2", someVal, someVal * 0.5)
instead of

  print("Half of $someVal is: ${someVal * 0.5}")
and a lot easier for a programming language to parse, without needing to feed the parser into the lexer. And you also get easy formatting of the decimal (e.g. %f5.2), whereas string interpolation (in Swift, Apache Groovy, etc) requires a separate call, e.g.

  print("Half of $someVal is: ${format(someVal * 0.5, "%f5.2")}")
Re:Lily Programming Language by drjeats on Saturday July 02, 2016 @01:16AM (#12021458)
C#'s new interpolation syntax is a counterexample to your point about easy formatting:

https://msdn.microsoft.com/en-us/library/dn961160.aspx#Ancho...

    $"Name = {name}, hours = {hours:hh}"
    var s = $"hello, {name}"
    System.IFormattable s = $"Hello, {name}"
    System.FormattableString s = $"Hello, {name}"
    $"{person.Name, 20} is {person.Age:D3} year {(p.Age == 1 ? "" : "s")} old."
Re:Lily Programming Language by tomp on Friday July 01, 2016 @09:52AM (#12015994)
(1) It's obviously less ambiguous, because you can't do it accidentially; "\(" is an invalid escape, whereas "${1}" or "$a" is a valid string (i.e. you could write it without meaning to interpolate the variables).

(2) It's only consistent if you always know what your pointers are pointing at, and whether your pointers are the last reference to it... but then you can just use delete, right?

Re:Lily Programming Language by berdario on Friday July 01, 2016 @10:44AM (#12016403)
(1) you're confusing C string and other languages strings (even Swift strings are not the same thing as NSString or C strings). Anyhow, even in C \( is perfectly accepted by compilers

    gcc -Wall -x c - <<EOF
    #include <stdio.h>
    int main(){ printf("\(hi"); }
    EOF
So it's perfectly reasonable to write it and not mean interpolation (maybe they meant "\\(", but that's another matter)

(2) A sequence can be sorted without you knowing which elements are inside it, A computation can be known to terminate without you knowing (yet) which value it will yield.

Similarly, you don't need to have internal knowledge of your code to know that you'll be able to rely on RC consistency in the future (otoh I guess that something consistent is not necessarily the same as something predictable)

Re:Lily Programming Language by hk__2 on Friday July 01, 2016 @06:46PM (#12020239)
> Anyhow, even in C \( is perfectly accepted by compilers

Even if it’s accepted it’s not valid, at least in the C99 standard.

Re:Lily Programming Language by reitanqild on Friday July 01, 2016 @10:30AM (#12016290)
> LoL. Refcounting can lead to just as long pauses as GC, if your reference is the last reference to a huge object graph.

Laughing out loud is fine I guess but it adds nothing to this discussion as that paragraph would easily stand on its own or even be better without.