Comments (22)
@mdbs99 my initial idea was to use ctor
and dtor
. Let's collect some opinions and I will make changes.
from eo.
@mdbs99 I agree. constructor
and destructor
are better names.
from eo.
@mdbs99 Sure. And I guess it would be just as easy to find if it was always first. Just a preference I guess.
from eo.
Do we need an explicit primary constructor? It seems to be the same all the time - something which accepts all the attributes and sets them as-is.
@gukoff I don't. What I want is that compiler not check if the "primary ctor" was wrote at the end. Just that.
No, I've addressed the concept, not your particular issue :)
Speaking of languages like Java, the requirement for a primary constructor to be written at the end looks logical. It reminds me of the common rule of putting private below public. The secondary constructors must be public; otherwise, they are useless. A primary constructor is sometimes public just to be used in unit testing and serves as a basis for the secondary ones.
from eo.
...a primary constructor to be written at the end looks logical.
@gukoff I don't see any logica here sorry. Anyway...
if I can put the constructors and methods in the sequence I want, without the compiler interfering, it will just be a matter of style. That just all I need.
from eo.
Constructors must be listed after attributes. The primary constructor must be the last one. The destructor, if it is present, goes right after the primary constructor.
We're talking about inline or temporal dependencies as a bad pratice, but we should write ctors dtors attrs
in a legal order.
from eo.
+1 for ctor/dtor
from eo.
ctor/dtor is preferred to me. Use object name as ctor/dtor is not obviously. Especially given the specialization.
Question:
object shape as Shape: ...
object rectangle extend shape:
rectangle can public shape ctor? Or base class ctor is private?
Other example:
object error as Error:
ctor(String: what):...
object logic_error extend error:
// Need ctor?
Hm... This extend does not make sense with some type of object. Maybe parent ctor need only for private use.
from eo.
@DronMDF there is no inheritance for Objects, just specialization for Types.
from eo.
Yep, sorry. extend only for types. Ok.
from eo.
Why the last one? The primary has to be the first, on top.
@mdbs99 Yegor wrote about this here.
from eo.
@pa9ey yes, I know, and agree with him — I have done this ~2 years before this article.
I guess you didn't understand me right:
Why the last one? The primary has to be the first, on top.
I meant: If the compiler will check the precedence, the primary ctor should be the first wrote in the code.
from eo.
Do we need an explicit primary constructor? It seems to be the same all the time - something which accepts all the attributes and sets them as-is.
from eo.
@mdbs99 I understood you. You were asking, Why the last one? Yegor addresses that very question in the article. I wasn't suggesting you should agree with it, nor that I do (or don't) - I was simply pointing out that he addresses your question, the one that I quoted.
from eo.
@gukoff Good point.
from eo.
@gukoff I don't. What I want is that compiler not check if the "primary ctor" was wrote at the end. Just that.
@pa9ey I'm sorry. I read the article again:
...a primary constructor, and it will always be easy to find because it stays below all secondary constructors.
Now I understood what you meant. But I disagree of Yegor in that case.
from eo.
So @yegor256, ctor
and dtor
won?
from eo.
@yegor256 ctor
and dtor
won?
Can I close this issue?
from eo.
+1 for constructor & destructor (readability in mind)
from eo.
Guys, it isn't going to be written in stone :) For the time being, both ctor
and constructor
are fine.
from eo.
@gukoff I agree with you.
So as @yegor256 didn't tell anything all these days and we've already voted, I'll finish this issue and, after, change the README if nobody does.
from eo.
@mdbs99 please submit a pull request for ctor
and dtor
. thanks!
from eo.
Related Issues (20)
- eo-runtime doesn't build when offline (no Internet connection) HOT 2
- Unsuitable types for + operation (xs:string, xs:integer). HOT 8
- Attribute @line is absent HOT 3
- Object Name Already In Use HOT 10
- `ResolveMojo` should not be part of `assemble` cycle HOT 11
- EOLANG paper has incorrect definitions HOT 1
- `eoc phi` translates `int.eo` in a wrong way HOT 4
- Java 8 is not supported HOT 9
- "good-first-task" -> "good first issue" HOT 3
- Can't `unphi` normalized programs HOT 18
- `eoc unphi` produces untestable programs HOT 12
- Atom `go` not needed HOT 8
- Some hash wasn't found when link Hello World HOT 8
- It's unclear where problematic object is used HOT 1
- How do you check that programs in the README work? HOT 2
- How to run eo:phi and eo:unphi? HOT 2
- `tuple` too complex and breaks LSP HOT 37
- Can't convert EO example in the README to PHI HOT 5
- Make XSD as powerful and as restrictive as possible HOT 1
- `PullMojo` and `ResolveMojo` are not proxy-aware HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eo.