News for hackers. Stuff that matters.
Re:Ask HN: Why use semicolons to terminate statements in mod... by cabalamat on Monday November 24, 2008 @05:27AM (#374655)
I agree. You often get multi-line statements and in many languages/APIs they're a nature way of doing things. Here's an example (in no particular language):

   win = Window.new()
      .setTitle("A new window")
      .setForeground(Red)
      .setBackground(White)
      .setMenuBar(fileMenu, viewMenu, helpMenu);
I think this would be uglier and more error-prone if instead you had to use \ or some other character to indicate they are all part of the same expression:

   win = Window.new()\
      .setTitle("A new window")\
      .setForeground(Red)\
      .setBackground(White)\
      .setMenuBar(fileMenu, viewMenu, helpMenu);
Re:Ask HN: Why use semicolons to terminate statements in mod... by timknauf on Monday November 24, 2008 @05:45AM (#374668)
Interesting. I hadn't come across that idiom before. In Python, you'll have things like:

  myLongList = [1, 2, 3,
                4, 5, 6,
                7, 8, 9]
No continuation character is needed, because the continuation is implied.

However, I can't think of a direct parallel to your example above. It looks handy. What API/language are you alluding to?

I guess the Pythonic way would be something like:

  win = Window(title = "A new window",
               foreground = "Red",
               background = "White",
               menuBar = [fileMenu, viewMenu, helpMenu])
But I disgress. :^)
Re:Ask HN: Why use semicolons to terminate statements in mod... by sc on Monday November 24, 2008 @08:13AM (#374754)
JavaScript can just as easily attain this way of using named parameters:

  win = Window.new({title: "A new window",
                    foreground: Red,
                    background: White,
                    menuBar: [fileMenu, viewMenu, helpMenu]});
Re:Ask HN: Why use semicolons to terminate statements in mod... by cabalamat on Tuesday November 25, 2008 @03:13AM (#376161)
What API/language are you alluding to?

As i said before: no particular language.

Re:Ask HN: Why use semicolons to terminate statements in mod... by sc on Monday November 24, 2008 @08:15AM (#374755)
The dot notation itself indicates continuation:

  win = new Window().
        setTitle("A new window").
        setForeground(Red).
        setBackground(White).
        setMenuBar(fileMenu, viewMenu, helpMenu);