Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>It is highly readable. And you can use '!' and '?' in names!

Somehow this feels a little contradictory.



Why do you feel it is contradictory? I think having method names end with "?" whenever they return a boolean value is quite intuitive. They seem to stand out more than having such method names start with "is" or "has". YMMV.


Looking back at some Dylan code again now, I still find its richer, Lisp-derived, hyphenated naming approach more readable-and-expressive than either camelCase or underscore_separated identifiers.

When Dylan switched from Lisp syntax this was something that was fretted over an awful lot, for obvious reasons, but we went with it and it worked fine.

I'd love to see some other algebraic (non Lisp) syntax language get more creative in this direction again one day.


It isn't.

Common Lisp and Scheme can do this as well and I like the look of predicate functions like "list?" or "number?":

    (list? object)
    (number? 1) => returns true
    (number? "abc") => returns false
It isn't really necessary for a language to support this, but it is a nice detail if one preferred such a style.

I think the custom is to use "!" in functions with side-effects.


More precisely, "functions that modify their arguments". For example,

  append(list,value)
returns a new list;

  append!(list,value)
modifies at least one of its arguments, typically, its first argument, but it could be another or multiple ones.

By the way, all of these are conventions. The language doesn't require you to use the punctuation (http://opendylan.org/documentation/intro-dylan/expressions-v...). The conventions grow on you soon, though (I never really wrote anything in lisp or dylan, but still would like to see more flexibility in allowed characters in names)

Functions that have side effects on non-arguments should be very rare, and don't use a naming convention (see for example http://opendylan.org/documentation/library-reference/common-...)




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: