Hacker News new | past | comments | ask | show | jobs | submit login

In languages without infix function calls, that should be possible, but I'm not sure how readable it would be.

    var initial factory = abstract configuration factory factory. configure new factory()



   var search result = users. find all by name (name);

   if (search result. is present()) { 
      return ok(search result. get());
   } else return not found();

It’s weird and syntax highlighting is absolutely necessary to read this.


Using something else than a dot is better, same as using a slightly different syntax:

   search result := users @ find all by name (name)

   if search result @ is present() { 
      return ok(search result @ get())
   } else {
     return not found()
   }


I still think the space adds more readability than the dot dectracts. If you don't like the dot though, I would use a comma. We have been writing for a couple centuries now, and the comma is well known and used.

   search result := users, find all by name (name)

   if search result, is present() { 
      return ok(search result, get())
   } else {
     return not found()
   }


Few more improvements:

   // comma is optional, used for disambiguation
   search result := users, find all by name. // omitted parameters match words

   if search result is present,  // empty brackets can be omitted
      return ok(search result value); // API change for better readability 
   else
      return: not found. // colon is another optional delimiter 
 
I actually like it so much, I would try to write a transpiler to Java…


I have to confess I rather like that comma!


Then we could use . instead of ; for line endings, and we're almost writing prose :)




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

Search: