uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Validate that there aren't two "visible" classes with same name in a file #1248

Open fdodino opened 7 years ago

fdodino commented 7 years ago

Today this is feasible. Nevertheless, it is error prone and a bad practice, I remember wasting several hours because of same reason in Arena.

So we should add a validator.

mmatos commented 7 years ago

Hi Fer, does this mean that project like the following should be split into independent wollok projects?

https://github.com/pdep-mit/ejemplos-de-clase-wollok/tree/master/ejemplos-de-clase-wollok-2017/src

Particularly I was going to pick up one of those examples we've done for a class to continue with what we have done already as base for next week. And since I need to be able to add new behavior and maybe refactor existing classes, I was going to copy everything to a new folder in the same project, so that would lead to having classes with the same name in the same project.

fdodino commented 7 years ago

Yes , this was related to #1144 . With @npasserini we agree there is no need for a student to have two classes with same name.

I understand your case (many of us took the same approach), my suggestion is to have several branches, one for each class, so you can checkout "class 1", "class 2", and so on.

mmatos commented 7 years ago

Right, using branches is the same approach we use for another subject, but I don't know if that will work well with Wollok IDE since I had issues already when switching branches (#1233).

fdodino commented 7 years ago

Relax, by the time we code this issue that will be fixed.

npasserini commented 7 years ago

Sorry, I am against this. The exact point of having name spaces is to allow to have multiple classes with the same name. What you should validate is not to have two visible classes with the same name. Also, if you like, you can validate not having two classes with the same FQN.

2017-09-06 11:08 GMT-03:00 Fernando Dodino notifications@github.com:

Relax, by the time we code this issue that will be fixed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/1248#issuecomment-327494847, or mute the thread https://github.com/notifications/unsubscribe-auth/AEa1Oc_yve5Qu34Ia4vU2zwtvGxi-JJuks5sfqdtgaJpZM4PMuxK .

fdodino commented 7 years ago

"Sorry, I am against this. The exact point of having name spaces is to allow to have multiple classes with the same name." That's why I asked before. OOOOOOOooooook, changing title.

fdodino commented 6 years ago

@npasserini No me queda claro qué sería "visible" en este contexto, lo paso a la columna Discuss para que quede una definición más clara.

npasserini commented 6 years ago

Visibles son dos clases importadas con el mismo nombre. Wollok debería permitir que yo tenga dos archivos

pepe.wlk con class Golondrina y pepe2.wlk con otra class Golondrina

pero no puedo hacer en un tercer wlk

import pepe.*
import pepe2.*

porque tendría dos Golondrina.

fdodino commented 6 years ago

Perfecto, de vuelta al Backlog.