Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 16:48
    SethTisue commented #12476
  • 16:47
    SethTisue commented #12476
  • 16:46
    SethTisue commented #12476
  • 16:46
    SethTisue closed #12476
  • 16:46
    SethTisue commented #12476
  • 15:43
    nigredo-tori commented #12476
  • 15:35
    nigredo-tori commented #12476
  • 14:37
    SethTisue commented #12476
  • 13:43
    nigredo-tori edited #12476
  • 13:33
    nigredo-tori edited #12476
  • 13:31
    nigredo-tori commented #12476
  • 13:27
    nigredo-tori edited #12476
  • 13:21
    nigredo-tori opened #12476
  • Oct 23 11:00
    LLCampos opened #2209
  • Oct 22 22:54
    SethTisue labeled #9790
  • Oct 22 22:54
    scala-jenkins milestoned #9790
  • Oct 22 22:54
    SethTisue opened #9790
  • Oct 22 21:11
    krasinski commented #12475
  • Oct 22 21:10
    krasinski commented #12475
  • Oct 22 17:55
    SethTisue assigned #1499
Bjorn Regnell
@bjornregnell
hi contributors and community leaders; it is currently a bit confusing where to post questions on what and where to pre-discuss potential issues and where to post actual issues, esp. since there are more than one place on github: scala and lampepfl, and several forums. It is also not obvious to me who are official leaders of what. The community page https://www.scala-lang.org/community/ could perhaps make this clearer. I suspect this is related to already on-going work on consolidating dotty into scala and some new working-structures and responsibilities etc, and I fully appreciate that in open source it takes some effort now and then to restructure things and re-think as we grow and mature. @SethTisue @smarter @tpolecat This is perhaps better discussed in a new Discourse thread (?), but wanted to check with you first here and maybe this is already in the pipeline. (PS1. Also, this is perhaps not a super-big deal; we can live with as-is and help each other to dispatch, but I think esp. for newcomers to our community we should be able to provide an easier explanation on the community page of what-goes-where and also on who-is-leading-what.) (PS2. Having discussed and posted some issues recently, I just want to say thanks to all here for all you super-friendly and awesome help; the Scala community is great :heart: ) )
Guillaume Martres
@smarter
I think it's something the scala center should take responsability for and it's probably best discussed in contributors.scala-lang.org yeah
Rob Norris
@tpolecat
Agree that this needs to be clarified.
Discourse seems right.
let me know if I can improve the intro text to better attract contributions to the thread
Guillaume Martres
@smarter
as a side note, here's the instructions I use for getting ~250 students started on scala each year: https://gitlab.epfl.ch/lamp/cs210/-/blob/master/labs/tools-setup.md https://gitlab.epfl.ch/lamp/cs210/-/blob/master/labs/example-lab.md
the basic idea is install coursier -> use coursier to install sbt -> use sbt and vscode for everything, never ever use the scala/scalac binary since they're not really useful and slow
Bjorn Regnell
@bjornregnell
thanx!! I guess your students know how to open a terminal?
Guillaume Martres
@smarter
the instructions say stuff like "open cmd.exe" on Windows
if they can't figure that out we help them
Bjorn Regnell
@bjornregnell
and they know what a compiler is?
Guillaume Martres
@smarter
I mean, I don't know, that's not presumed
Bjorn Regnell
@bjornregnell
Previous years we did like this: first week Kojo desktop (because we have a mninority that never have coded, say 20% and if we all start with "kids" programming it is more playful and it is obvious that Kojo is for kids - this week we try to establish a good community behaviour in the class were the ones who already know a lot help in a respectful way without taking over but helping conceptual understanding - my mantra is that coding is learning for life and pedagogy is integral to coding and coding is social (most of my students are around 19 years old). Second week REPL in terminal, compile in terminal to see the bytecode and see that the compiler is a program like all other programs with input and output. week 3 vscode+sbt for the rest of the course, but in week 8 I encourage the ones who want new challenges to try out IntelliJ.
So if i go vscode+sbt only I need to rethink the start... And I like REPL in terminal; use it all the time :)
Guillaume Martres
@smarter
https://gitlab.epfl.ch/lamp/cs210/-/blob/master/labs/example-lab.md mentions both how to use the REPL and how to use worksheets and anecdotally at least it seems that students always prefer using worksheets
Bjorn Regnell
@bjornregnell
maybe I'm getting old :)
Guillaume Martres
@smarter
we use console from sbt to start the REPL, which has the advantage of having your classpath setup correctly
Bjorn Regnell
@bjornregnell
yes the worksheet has many advantages; but currently I cannot have worksheet on top level in vscode if I understant it correctly
Guillaume Martres
@smarter
on top level?
Bjorn Regnell
@bjornregnell
You need to put the worksheet in src/ceremony and yes console in sbt is nice; and also Compile / console / initialCommands
we use it but later
the first week i want one file, top-level defs and just rock :)
Guillaume Martres
@smarter
ah, I don't know how metals handles source directories, if it respects the sbt config you should be able to put worksheet files in the root directory and they'll be part of the root project
Bjorn Regnell
@bjornregnell
all tweaks can be done, but one click rules :)
Guillaume Martres
@smarter
sbt default list of source directories contains "." and "./src/main/scala/" iirc
Bjorn Regnell
@bjornregnell
yes but metals is confused about default package - let me see if I can find the issue
Guillaume Martres
@smarter
ok I have no idea what metals is doing here
Bjorn Regnell
@bjornregnell
BTW: I want them, when we have gotten some weeks into the course, to at least once to set up the -classpath themselves with at least one jar and at least once compile more than one file in terminal to understand a bit of what is happen under the hood (what is a package and a code unit etc and what files are involved). => So I want scalac on their path.
How "old" are your students? What courses have they taken before?
Guillaume Martres
@smarter
they're second year CS students
they see Java in their first year although that's changing to python now apparently
Bjorn Regnell
@bjornregnell
so they have already some tacit knowledge internalized, diffusing from the university walls around them :)
that old pyhton is taking the planet with storm
do you know how many that start CS year 1 with no coding experience at all?
Guillaume Martres
@smarter
no, but most I'd say
Bjorn Regnell
@bjornregnell
yeah, I guess your pre-knowledge span is perhaps less than mine, and the minimum level is obviously higher for year 2
One reason that I put emphasis on at least once do stuff in terminal without IDE stuff is that before I took over the then Java course with all Eclipse, teachers in later curses complained that students did not know how to do "simple" stuff in terminal... Nowadays their terminal street-smartness has improved significantly :)
Override-6
@Override-6
Hey, i am currently trying to generate scala sources code in order to generate classes at runtime. The concept of this project is to generate a class that will extend a given class then override every methods of the super classes (This will allow me to make a RMI system). In order to generate valid method overriding, i have to reproduce the exact same signature. I have a problem concerning the typing (type parameters, return type, argument types), and more precisely when the type declaration is this.type. With the wonderful reflection library, i can get a type from a point of view (let's say i have a class A[T] and an implementation B extends A[String], i can get the type of T from the point of view of the B class which is String (with Type#asSeenFrom)). So, for my tests, i want to generate a class extending from a pretty complex class (PuppetListBuffer[A] extends ListBuffer[A]). This type contains a method (def lazyZip[B](that: Iterable[B]): LazyZip2[A, B, this.type]) declared in Iterable.scala. As you can see, the return type of this method contains a this.type type declaration. The problem is that since i use Type#asSeenFrom in order to get a type seen from the ListBuffer class, the result that i get is LazyZip2[A, B, ListBuffer[A]], which is quite satisfying but it's not the valid type declaration for a method overriding signature (must be this.type instead of ListBuffer[A]), and that's why scalac refuses to compile my class every time.
So, do you know if it's possible to get the Point of view of an implementation ?
or, do you have any other way to support this ?
zygfryd
@zygfryd
How are you going to deal with final classes and final methods? What exactly is the overriding code doing?
Rob Norris
@tpolecat
If you limit yourself to interfaces (as Java RMI does) you can use the dynamic proxy stuff in the JDK and you don't have to mess with macros or code generation.
Seth Tisue
@SethTisue
@Override-6 trying to reverse engineer source code from the information available via reflection sounds like a really difficult problem to me
Override-6
@Override-6
@zygfryd just add some filter to methods you have to generate :p
Override-6
@Override-6
I would like to make a more complex and autonomous rmi system, so limiting to interfaces is great but not enough (With the system i'm trying to make, i could be able to synchronise instances of any object i want (Map, List, Player, World etc...) and this is more easy to use than to create interfaces for this behavior
@SethTisue but scala does it ? in any case, it is able to find this kind of information from compiled classes. i only have difficulties with typings, is it possible to make scalac regardless on typing ?
Override-6
@Override-6
scala compiler*
Override-6
@Override-6

What exactly is the overriding code doing?

Here is the method who is in charge of generating the right return type declaration:

private def getReturnType(method: MethodDescription): String = {
            val symbol  = method.symbol
            val tParams = method.desc.classType.typeParams
            val tpe     = symbol.returnType
            renderTypes(Seq(( {
                val base        = method.desc.classType
                val methodOwner = symbol.owner
                tpe.asSeenFrom(base, methodOwner).finalResultType //here is where i set the Point Of View of the type from the ListBuffer class
            }, tParams.indexOf(tpe))), symbol, tParams)
                    .mkString("")
        }