propositions for scala that could increase reliability and controllability

75 views
Skip to first unread message

arkantos

unread,
May 3, 2013, 7:27:47 PM5/3/13
to scala-...@googlegroups.com
There are a few things I always missed in java:
1) design by contract (pre- and post condition, invariant ...)
2) class scoping like in eiffel:
   wouldn't it be handy to hide functions from other objects except from those we gave the permission to access
 
   ex: {A,B} class C extends D ...
      -> only A, B and C itselve may access the methods of C

  thus we could use a strict variation of the fascade pattern or do any other helpful things. It shouldn't be overused of course but we gain much more control of who  uses our classes.

This expansions wouldn't affect old code i guess, because there's no need to change anything about the scopes used so far (private, ...)

Moreover we could find many bugs at compile time. Debugging and Testing might get much easier.

Paul Phillips

unread,
May 3, 2013, 7:55:01 PM5/3/13
to arkantos, scala-debate

On Fri, May 3, 2013 at 4:27 PM, arkantos <kikev...@gmail.com> wrote:
   ex: {A,B} class C extends D ...
      -> only A, B and C itselve may access the methods of C

I recently proposed that access should be done with annotations. Using type bounds to articulate access restrictions would allow for that level of granularity, and much more. Plus we could throw two keywords back into the hopper.

Reply all
Reply to author
Forward
0 new messages