Link Details

Link 586241 thumbnail
User 744963 avatar

By inphina
Published: Apr 14 2011 / 12:26

DSL (Domain Specific Language) is a programming language or specification language dedicated to a particular problem domain, problem representation or a particular solution technique. So with a few Scala Nuggets on our way we are ready to write a DSL? Not quite but in this post we would touch upon a critical feature in Scala which makes writing DSL’s easy. Let us look at the following code snippet. view sourceprint? 1 println (1+2) 2 println (1 .+(2)) 3 println (1.+(2)) 4 println (1 +(2))
  • 7
  • 0
  • 2128
  • 1
User 265013 avatar

darkfrog replied ago:

0 votes Vote down Vote up Reply

The last example could be much more elegantly be written:

def switchOnACat(n:Int) = n > 35

User 744963 avatar

Inphina Technologies replied ago:

0 votes Vote down Vote up Reply

Excellent point darkfrog. Totally agreed, I would cross post this on the blog as well.

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Upvoters (7)

Downvoters (0)

    Apache Hadoop
    Written by: Piotr Krewski
    Featured Refcardz: Top Refcardz:
    1. Play
    2. Akka
    3. Design Patterns
    4. OO JS
    5. Cont. Delivery
    1. Play
    2. Java Performance
    3. Akka
    4. REST
    5. Java