by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Vojin Jovanovic
    @vjovanov
    Only, I think you will loose auto-completion.
    cvogt-gitter
    @cvogt-gitter
    I am thinking something like implicit def select[T](r: Record[T]): T = macro …
    with the implicit conversion?
    Vojin Jovanovic
    @vjovanov
    No, this does not work. You need macro materializers for this. Because if the macro you gave fails it stops the implicit search.
    cvogt-gitter
    @cvogt-gitter
    I agree
    how about:
    Vojin Jovanovic
    @vjovanov
    TiarkRompf/virtualization-lms-core#78
    Here you go :)
    All in one pull request!
    cvogt-gitter
    @cvogt-gitter
    @implict implicit def select[T](r: Record[T])(implicit m: Materializer[T]): T = m.createAnonymousClass
    and trait Materializer[T]{ def createAnonymousClass: T = macro ... }
    Vojin Jovanovic
    @vjovanov
    Not going to work. The macro must generate the return type.
    Look at the pull request, it is all done there.
    cvogt-gitter
    @cvogt-gitter
    I was hoping to get it work with intellij code completion. Does the PR do that?
    if the materializer is a whitebox macro, which reflection still be used, because T will be a structural type, despite all that inlining?
    Vojin Jovanovic
    @vjovanov
    No, for intellij you need to bulid a plugin for intellij.
    No reflective calls in the end, AFAIR.
    cvogt-gitter
    @cvogt-gitter
    Thx. I’ll read the PR and play a bit more with the approach.
    Daniel Wegener
    @danielwegener
    Hello guys! Just a curious question: Is the following expected behavior?
    scala> import records.Rec
    import records.Rec
    
    scala> Rec("crazy-name" -> "Hannah").`crazy-name` // works
    res0: String = Hannah
    
    scala> Rec(`crazy-name` = "Hannah").`crazy-name` // does not work
    java.util.NoSuchElementException: key not found: crazy-name
    From my very naive perspective - it should work. Bad thing - it crashes at runtime.
    Tobias Schlatter
    @gzm0
    Looks like an encoding issue (whether or not - is encoded). You may file a bug with this.
    Vojin Jovanovic
    @vjovanov
    Thanks for reporting: scala-records/scala-records#110
    cvogt-gitter
    @cvogt-gitter
    @vjovanov FYI: I rebranded my records and tmap lib to Compossible. The scala days stuff was already printed, so it still says “Scala Records”. I’ll explain the difference in the talk and give you guys and Shapeless some credit. I mostly want people to be excited about records and start using them, whatever implementation.
    cvogt-gitter
    @cvogt-gitter
    Had a very long and productive discussion with @gzm0 today and yesterday. We may be able to learn quite a bit from each other and potentially merge efforts.
    Rec[{…}] instead of Rec{…} seems to solve many of your problems.
    using macros in anonymous subclasses ala new{ def field = macro … }.field solved one of mine
    @vjovanov
    Rec[{…}] allows me to have human writeable types and never use a top-level structural type. For you guys it also allows to implement backends without having to implement a macro library if we are not mistaken.
    We also discussed about how to support operations like structure maintaining merges and selects in a scenario with different backends.
    cvogt-gitter
    @cvogt-gitter
    @gzm0 FYI: http://docs.scala-lang.org/overviews/collections/performance-characteristics.html seems to indicate “effective constant time” performance for hashmap remove. Somebody below claims that actually means log_32(n)
    Vojin Jovanovic
    @vjovanov
    I know about that as I implemented it in LMS a few months ago. Did you manage to get code completion in REPL and in the IDE? I believe that this is one of the most important features for databases.
    cvogt-gitter
    @cvogt-gitter
    @vjovanov haven’t tried it yet, but it is all blackbox macros or whitebox macros with good enough signatures, so I am very optimistic for IntelliJ. The REPL doesn’t code complete implicit conversions, which I am using right now. it also doesn’t seem to complete any expressions but identifiers with know types. so even explicit conversion doesn’t help. Right thing would be fixing the repl
    Ammonite DOES code complete it
    [info] Loading global plugins from /Users/chris/.sbt/plugins
    [info] Set current project to Ammonite Repl (in build file:/Users/chris/bin/ammonite-scala-repl/)
    > test:console
    [info] Starting scala interpreter...
    [info]
    @ implicit def foo(i: Int) = new {def hello = "Hello"}
    defined function foo
    @ 4.h
    hashCode   hello
    scala 2.11 REPL does not
    Welcome to Scala version 2.11.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55).
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    scala> implicit def foo(i: Int) = new {def hello = "Hello"}
    warning: there was one feature warning; re-run with -feature for details
    foo: (i: Int)AnyRef{def hello: String}
    
    scala> 4.he
    Allen Nie
    @windweller
    Hi! Sorry to bother you guys. I'm developing a Panda-like Scala library to parse formatted data and put them in efficient collection-like structure! One of the problem I encountered is a mixed type in a table row. I saw a benchmark package on the repo, but I didn't see any benchmark code (or at least I can't understand it). My question is: was Scala-record tested for speed? I really like the idea of storing heterogenous functions instead of actual value!
    Tobias Schlatter
    @gzm0
    @windweller IIRC the benchmarks are about compilation time. In terms of runtime, scala-records allow the data to be stored in any way you like. If you have a Rec(a = 1) constructor, they are just stored in a hashmap. So accessing a is just a hashtable lookup.
    @vjovanov knows more about the benchmarks
    Vojin Jovanovic
    @vjovanov
    They were tested for both access time and compile time. To put it short you are safe with them as runtime speed is very close to tuples, and in addition we specialise the values. Compilation overhead is negligible and you can use them all over the place without performance penalties (in the IDE as well).
    Sushant Hiray
    @sush-hiray
    Hi. I was looking into scala-records and the readme says we can use it for manipulating json data.
    I've a json which is essentially a serialized map with keys as string but the value can be primitive types. collection of primitive types or sometimes a nested object.
    I was wondering if I can parse my json string into Map[String, Rec]? If it is not currently supported I can try adding the support for json serialization/de-serialization. I wanted to see if this could be a valid use case
    Tobias Schlatter
    @gzm0
    I think this would be a good use-case for a library that uses scala-records, rather than core scala-records functionality.
    Shashank Shekhar
    @shkr
    Is there a Json Serialization API for Rec in the roadmap?
    Tobias Schlatter
    @gzm0
    No, definitely not in the core library.
    Olivier Mélois
    @Baccata
    Hello, does scala-records allow for record extension (ie appending records together, etc)
    ?
    Tobias Schlatter
    @gzm0
    Nope, that's on the todo list :)
    Inash Zubair
    @inash
    Hi. What's the status on the project? As there hasn't been much activity lately, the most recent commit was on Oct 10, 2016 support scala 2.12.0-RC1. Also, how well does it play with akka-remote for passing record data across remote actors?
    Vojin Jovanovic
    @vjovanov
    The project is not under active development. However, if there is interest for improving the library all PRs will be reviewed and merged. Also, if the library is required for an important project the development can be continued.
    Interplay with akka-remote was not tested.