You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by "Brandon Sloane (JIRA)" <ji...@apache.org> on 2019/07/20 01:53:00 UTC

[jira] [Commented] (DAFFODIL-2169) Add type safety to DPath variables

    [ https://issues.apache.org/jira/browse/DAFFODIL-2169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16889282#comment-16889282 ] 

Brandon Sloane commented on DAFFODIL-2169:
------------------------------------------

Not actually related to Daffodil, but I spent long enough figuring this one out, I wanted to post here. A mistake in defining the AnyVal class can break Eclipse:

https://scala-ide-portfolio.assembla.com/spaces/scala-ide/tickets/1002925-stack-overflow-in-erasure-scala/details#

> Add type safety to DPath variables
> ----------------------------------
>
>                 Key: DAFFODIL-2169
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2169
>             Project: Daffodil
>          Issue Type: Improvement
>          Components: Clean Ups
>            Reporter: Brandon Sloane
>            Assignee: Brandon Sloane
>            Priority: Major
>
> Currently our DPath runtime (and, I believe, main infoset) pass around values of type AnyRef, which affords almost no protection through the Scala type system.
> This was done to avoid the boxing overhead normaly associated with creating case classes. However, it should be possible to create an unboxed type that can provide some level of type safety. 
> Simmilar to our current Maybe type, can can create a new value type that wraps AnyRef. Being a value type, it will not require boxing. We can then make the main constructor hidden, and provide constructors only for those types that we want to allow as DPath variables.
> This should provide us type safty in assiging to DPath variables. Reading the values will still involve dealing with AnyRef however.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)