You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python allows a semicolon for joining statements on one line, so there's precedent. It's mostly considered bad style in production code, but is useful for shell commands, although the inability to join certain statement types limits its usefulness.
for: i :in range:3 print:i print: (i*i)
print:'hi' for: i :in range:3 print:i
for: i :in range:3 for j :in range:3 print: i j
But the class doesn't quite work:
class: Foo:object def: foo: self x print:x # print in params
class: Foo:object def: foo: self x
print:x # print in class
But with a semicolon acting like a Lisp closing parenthesis,
class: Foo:object def: foo: self x; print:x
It's almost never used at the end of a line in Python (although this is technically allowed) and it would tend to be a long train in a Lisp, so I'd rather not allow it in Hebigo. But even internal-only, you can get doubled semicolons for reasonable use cases:
class: Foo:object
def: foo: self x y
print: x y
def: bar: self a b
print: a b
# one-liner version
class: Foo: object; def: foo: self x y; print: x y;; def: bar: self a b; print: a b
Maybe this is OK for shell commands, but it does require more careful thinking than the usual indentation-based notation.
If you think of x:/; as parentheses, the Lispiness becomes more apparent. Both forms at once to show where the double came from:
class:
Foo:
object;
def:
foo:
self x y;
print:
x y;;
def:
bar:
self a b;
print:
a b;;;
You can see a train of three at the end. This wouldn't be allowed of course, but it does show the structure.
It could also make normal code more compact, but I find this less readable:
class: Foo:object
def: foo: self x y; print: x y
def: bar: self a b; print: a b
So, as in Python, I think they should be considered bad style in source code. I can't think of a case where it reads better, but it would make any expression possible as a one-liner, a capability that Python lacks but has some compromise support for. You can theoretically do all of your one-liners in Lissp anyway, so I'm not sure if this is worth it.
The text was updated successfully, but these errors were encountered:
Python allows a semicolon for joining statements on one line, so there's precedent. It's mostly considered bad style in production code, but is useful for shell commands, although the inability to join certain statement types limits its usefulness.
Hebigo can do some of these already.
But the class doesn't quite work:
But with a semicolon acting like a Lisp closing parenthesis,
It's almost never used at the end of a line in Python (although this is technically allowed) and it would tend to be a long train in a Lisp, so I'd rather not allow it in Hebigo. But even internal-only, you can get doubled semicolons for reasonable use cases:
Maybe this is OK for shell commands, but it does require more careful thinking than the usual indentation-based notation.
If you think of
x:
/;
as parentheses, the Lispiness becomes more apparent. Both forms at once to show where the double came from:You can see a train of three at the end. This wouldn't be allowed of course, but it does show the structure.
It could also make normal code more compact, but I find this less readable:
So, as in Python, I think they should be considered bad style in source code. I can't think of a case where it reads better, but it would make any expression possible as a one-liner, a capability that Python lacks but has some compromise support for. You can theoretically do all of your one-liners in Lissp anyway, so I'm not sure if this is worth it.
The text was updated successfully, but these errors were encountered: