Feature request: one-statement functions without brackets

eao197 eao197 at intervale.ru
Mon Apr 2 22:20:04 PDT 2007


On Tue, 03 Apr 2007 03:00:36 +0400, Jari-Matti Mäkelä  
<jmjmak at utu.fi.invalid> wrote:

> eao197 wrote:
>> An interesting example of language syntax simplification can be seen
>> from Scala language (http://www.scala-lang.org).
>
> I've recently read about Scala. It's a very promising language. Maybe a
> bit slow currently, but I've read they are working on it.

<offtopic>
 From my expirience Scala isn't slow. It seems to be slow because of use of  
JVM, but real application speed highly depends from the task and  
algorithms. Scala has a quick compiler. Expecially in form of fsc /fast  
scala compile/ when part of compiler resides in memory all the time (in  
such case speed of fsc on my laptop is comparable with speed of DMD). And  
on some microbenchmarks Scala outperforms C++. For example in simple  
message outperforms beetwen threads Scala shows throughput ~800K m/s, and  
C++ with ACE only ~600K m/s. I think it is because of great GC from JVM  
1.5.
</offtopic>

> I personally would like to see the gap between static (compile time) and
> dynamic (runtime) worlds closing. There are so many similarities between
> templates and ordinary functions & lambdas. Also type inference could be
> more general. Of course I understand Walter has only limited time and
> everyone has their favorite feature request, but these things look
> important to me ATM. It just seems that there's no clear roadmap and the
> language is just wandering blindfolded there somewhere. What do you  
> think?

Excuse me, but I haven't any global ideas of the way D may come in the  
future.

Last 2.5 years I wrote a lot on Ruby, sometimes I wrote (and write now) on  
Ruby much more then on C++ (and I'm C++ programmer now). And I had deep  
look into Scala as a very interesting and highly portable language  
(because of JVM). And breif look into Nemerle. However I decided to stop  
my search for my next big language on D, because it is very easy to me as  
a C++ programmer and, imho, much more expresive than C++/Java/C#.

But when I need to switch from Ruby or Scala to C++ or D I have a high  
degree of discomfort: after Ruby/Scala expirience usage of semicolons is  
very annoying (and, sometimes this is true for 'return' statement).

I understand that transforming IfStatement/SwitchStatement from a  
statement to an expression may be very hard. And optional ReturnStatement  
may be very hard to implement too. It would be great, but if not it won't  
be a tragedy. But I hope that optional semicolons is much easier to  
implement. And such trifle can make D much more expressive (the Scala  
history shows this).

-- 
Regards,
Yauheni Akhotnikau



More information about the Digitalmars-d mailing list