Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
John Sullivan
@sullivan-
Hi @mardo! Thanks for writing. I'm glad you liked the video
I don't use IDEA much, so I haven't seen that before. It's no good if IDEA is reporting errors like this. Let me look into it.
It might take a bit as I probably should install a recent version of IDEA first
Mardo Del Cid
@mardo
I remember IDEA didn’t play well with “old style” macros
I think it supports scalameta now
John Sullivan
@sullivan-
If I can't get IDEA to clear those errors, I think there's stuff we can do on the longevity side
Yeah. I would like to migrate to scalameta, but the feature set isn't quite there yet to support what we're doing
Mardo Del Cid
@mardo
ok, I just wanted to raise the concern :)
John Sullivan
@sullivan-
Yes, thank you very much for pointing that out. I definitely want to know about things like this!! (And I don't have the bandwidth to experiment in every possible dev environment ;))
Mardo Del Cid
@mardo
that’s what the community is for ;)
John Sullivan
@sullivan-
On the longevity API side, one thing we could do is allow the user to write object User extends PType[DomainModel, User] ..., even tho the macro puts in that extension for you
that would allow for the resolution of the error on primaryKey
Mardo Del Cid
@mardo
yeah, that’s an easy fix
John Sullivan
@sullivan-
But not the props
Mardo Del Cid
@mardo
yup :)
John Sullivan
@sullivan-
For props, I think other ppl use dynamic method approach to work around that
for instance, something where you could write User.dprops.username[Username] instead 0f User.props.username
so you would have to supply the type manually, and dynamic methods have a minor runtime overhead.. and you could get a runtime error if the types don't match
Mardo Del Cid
@mardo
hehehe… I think I prefer to see a couple of red text than going through all this
John Sullivan
@sullivan-
I should really look into how shapeless handles this, and if code that uses shapeless presents spurious compiler errors in IDEA
Mardo Del Cid
@mardo
or use ENSIME as you do!
aaah yeah, the more you do on shapeless the better
Sorry, what I wanted to say is that maybe you can not only see how shapeless does this, but do more things with shapeless than with macros
John Sullivan
@sullivan-
I've got to get back into using ENSIME more. I'm typically lazy and just use Emacs
Mardo Del Cid
@mardo
not sure if everything is possible though
John Sullivan
@sullivan-
yeah, i still intend to migrate a lot of internals to longevity. but it just takes time. at the moment, I'm putting "schema migrations" at top priority.
Okay, I'm going to install IDEA and take a look
Mardo Del Cid
@mardo
cool
the whole project is awesome
John Sullivan
@sullivan-
thanks man!
Mardo Del Cid
@mardo
One question I was curious about, there’s no support for inheritance in the persisted case classes props, like this for instance:
@persistent[DomainModel]
  case class User(
    username: Username,
    email: Email,
    fullName: FullName,
    answers: List[Answer] = Nil
  )

  trait Answer

  @component[DomainModel]
  case class AAnswer(a: String) extends Answer

  @component[DomainModel]
  case class BAnswer(b: Int) extends Answer
Mardo Del Cid
@mardo
:O !
John Sullivan
@sullivan-
when we move to shapeless we'll have to start sealing that trait
Mardo Del Cid
@mardo
I just had a geekgasm
John Sullivan
@sullivan-
:smile:
Mardo Del Cid
@mardo
I think this polymorphic feature was the deal breaker to choose longevity
in a project I am about to start for a customer
John Sullivan
@sullivan-
thats great to hear
John Sullivan
@sullivan-
Looks like this is the thing to use to get IDEA to understand the macros: https://blog.jetbrains.com/scala/2015/10/14/intellij-api-to-build-scala-macros-support/
Mardo Del Cid
@mardo
The links in there are broken, but I’ll see if I can use information to do a workaround
Here's my longevity about IDEA support: longevityframework/longevity#36
issue that is
@mardo I would be thrilled if you wanted to try either of the approaches I mention in the ticket. Of course the IDEA API approach would be best, but it's going to be a good bit of work, and I'm not even sure up front if their API is flexible enough to make it happen
The "workaround" approach I describe in the ticket would be much more straightforward.
It puts a minor ugly into the longevity API (a method in PType that's not very typesafe), but I'm okay with that. We can put a disclaimer in the scaladocs
John Sullivan
@sullivan-
Just taking a look at longevity src and yeah, that second approach would be very straightforward
Mardo Del Cid
@mardo
I think writing as less boilerplate as possible is the best option
It is really a IDE limitation, not really a framework one. However, a lot of people is using IntelliJ, so maybe the IDEA API approach is the best fit here. I’ll have a look when I have a chance