DSL's: any way to provide meaningful error messages?

31 views
Skip to first unread message

Kostas kougios

unread,
Oct 6, 2012, 6:13:11 PM10/6/12
to scala...@googlegroups.com
I've made a DSL. When the code using the DSL is correct, everything reads fine. But when there is a compilation error, I get error msg's like

overloaded method value === with alternatives:   (v: com.googlecode.mapperdao.ColumnInfo[_, String])com.googlecode.mapperdao.Operation[com.googlecode.mapperdao.SimpleColumn] <and>   (v: String)com.googlecode.mapperdao.Operation[String]  cannot be applied to (com.googlecode.mapperdao.ColumnInfoManyToOne[QueryAutogeneratedSuite.this.Computer,Int,com.googlecode.mapperdao.SurrogateIntId,QueryAutogeneratedSuite.this.Company])

which is quite hard for the DSL user to understand. Is there a way of customising error messages? (googling didn't return any results)

Seyed H. HAERI (Hossein)

unread,
Oct 6, 2012, 6:47:51 PM10/6/12
to scala-user
Scala Virtualised is your friend:


Whilst it can be very useful under many circumstances, Virtualised too comes with its limitations. I'm not sure whether it will solve your particular problem. But, it is certainly worth taking a look. :)

Enjoy!
--Hossein
--
--------------------------------------------------------------------------------------------------------------

Seyed H. HAERI (Hossein)

Research Assistant
Institute for Software Systems (STS)
Technical University of Hamburg (TUHH)
Hamburg, Germany

ACCU - Professionalism in programming - http://www.accu.org/
--------------------------------------------------------------------------------------------------------------

Naftoli Gugenheim

unread,
Oct 11, 2012, 11:19:05 PM10/11/12
to Kostas kougios, scala...@googlegroups.com
If the error is that an implicit is not found (and perhaps you can refactor so that is the case), there's the @implicitNotFound annotation, which gives an alternative error message (it can even contain placeholders for the actual types involved).
Reply all
Reply to author
Forward
0 new messages