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
  • 2100
  • 1


Add your comment
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.

Voters For This Link (7)

Voters Against This Link (0)

    Java Performance Optimization
    Written by: Pierre-Hugues Charbonneau
    Featured Refcardz: Top Refcardz:
    1. Design Patterns
    2. OO JS
    3. Cont. Delivery
    4. Java EE7
    5. HTML5 Mobile
    1. Node.js
    2. Debugging JavaScript
    3. OO JS
    4. JSON
    5. Ajax