GithubHelp home page GithubHelp logo

Comments (47)

mdbs99 avatar mdbs99 commented on July 17, 2024 6

@pa9ey maybe create/destroy ?

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024 3

@stain please, no underscore! :)

from eo.

nqafield avatar nqafield commented on July 17, 2024 3

@yegor256 construct/destroy?

I know that the constructor and destructor are "special" methods in a sense and are called implicitly, but why name them differently than other methods? Methods are normally named as commands or verbs. You wouldn't say file.reader().

from eo.

stain avatar stain commented on July 17, 2024 2

from eo.

nqafield avatar nqafield commented on July 17, 2024 2

@yegor256 How about this? (^; http://poll.lab.io/G5h11XOB__BL8YbksgxErw

from eo.

Tertioptus avatar Tertioptus commented on July 17, 2024 2

Like myself, I think there are a few non-contributors, so I'm not sure we should have an equal vote.

I propose that the Republic of EO vote for their top 3 favorite contributors to the project. And those three will vote to make the final decision. Their work and insight are already on display.

A periodical election wouldn't be bad either, to encourage leadership, responsibility, engagement which should lead to progress and quality, and not an abandoned project.

from eo.

yegor256 avatar yegor256 commented on July 17, 2024 2

My main priority is to make these creatures (ctor and dtor) obviously different from methods. That's why I don't really like create/destroy and other English words. That's why ctor/dtor is a good option for me, as well as +/- (even though semantically they are not really a good fit). See the point?

from eo.

stain avatar stain commented on July 17, 2024 1

Sorry, two weeks ago was a busy period for me and I missed #29 - it can be hard to keep track!

Let's have a alternative vote poll instead of changing it back and forward :)

from eo.

stain avatar stain commented on July 17, 2024 1

I think we want to keep the "object forking" like author("a",1) -- that might make it easier to support functions as objects or "constructors" that return an object with slightly different types than the original.

Perhaps when declaring this should be a special method name call() or something? Python has __call__() for this purpose (handle function call), but also __new__ (make object of this class) and __init__ (initialize self after it has been made). We hopefully won't need as many!

from eo.

nqafield avatar nqafield commented on July 17, 2024 1

@mdbs99 Yep. Even better.

from eo.

Tertioptus avatar Tertioptus commented on July 17, 2024 1

@pa9ey Yes! Thus construct and destruct are better than constructor and destructor. Yet, colloquially, create and destroy are more palatable. So I'm all in for create and destory. I think David West of Object Thinking would agree.

from eo.

Tertioptus avatar Tertioptus commented on July 17, 2024 1

@mdbs99

"release" actually makes more sense. "create" and "release". But not sure if that is too restrictive. It seems this language should be interpreter agnostic, such that we could port it to a platform that does not manage memory. Which begs the question, is "memory management" essential to declarative programming. Maybe I'm getting to far in the weeds.

from eo.

stain avatar stain commented on July 17, 2024 1

from eo.

Tertioptus avatar Tertioptus commented on July 17, 2024 1

Okay then, could we just internationalize the language itself, such that nominally the keywords are concept-driven. For all I care, the keywords could all be in abbreviated Latin, as long as my IDE can render it to an American-English set for me.

brainstorming babble:
Even the Type level EO docs could contain a has for like translations, just in case someone wrote the code in Russian.

As longs as class names or nouns, and method names are verbs.

from eo.

alexpanov avatar alexpanov commented on July 17, 2024

Thank you. I wanted to raise the same issue.
Keywords must be words first, keys second

from eo.

aravindps avatar aravindps commented on July 17, 2024

I agree!

from eo.

MadridianFox avatar MadridianFox commented on July 17, 2024

👍

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024

I agree.
When I've started the #29 was about not use "same name of Type for constructors" and not use "~destructor C++ style".

But where were you who didn't vote?
Well, maybe we can change this now.

from eo.

alexpanov avatar alexpanov commented on July 17, 2024

It's just an early draft. Many changes is something that one would only expect at this stage.

from eo.

yegor256 avatar yegor256 commented on July 17, 2024

@Tertioptus for me constructor just looks too long, that's why I was in favor of ctor in #29. How about before/after?

from eo.

moriline avatar moriline commented on July 17, 2024

I think that keyword "new" for constructor is the best way.

from eo.

Lebedevsd avatar Lebedevsd commented on July 17, 2024

@moriline why do we need new keyword, if instead of it we could directly call ctor?

why do you think that Author.new("a", 1) is better than author("a",1)?

from eo.

moriline avatar moriline commented on July 17, 2024

@Lebedevsd Because "new" keyword(and as a word) means "new object" - this is exactly action what we do with/on type. For example:

Author.new("a", 1)

I order TYPE create NEW object with PARAMS.
"new" - constructor/action which we use on type of Author

Author author = Author.new("a", 1){
	String .name
	int .age
	new(String name, int age){
	    .name = name
	    .age = age
	}
	String name(){
	    return .name
	}
	
	int age(){
	    return .age
	}
}

There we are define and assign object of Author type.

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024

@moriline I like the idea of using new too, but what happens with destructor, which name use if we choose new for constructor?

I order TYPE create NEW object with PARAMS.
"new" - constructor/action which we use on type of Autho

But we can't implement more than one type?

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024

@yegor256 maybe we can use new for constructors and died for destructors. Both are short.

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024

@pa9ey I was inspired by Object Pascal (OP).
However, OP has two keywords for constructors and destructors, ie, constructor and destructor. But they have names too. These names, by convention, are Create and Destroy.

constructor Create(Foo: Integer);
destructor Destroy;

from eo.

Tertioptus avatar Tertioptus commented on July 17, 2024

Would giving a Type the ability to "create" and "destroy" objects of it's specification, would that compromise the existence of objects that have public "create" or "destroy" behaviors.

from eo.

moriline avatar moriline commented on July 17, 2024

@mdbs99 What about this?

Book book1 = Book.new("a", "1234"){
	String .title
	String .isbn
	new(String title, String isbn){
		.title = title
		.isbn = isbn
	}
	
	new(String title){
		new(title, "1111")
	}
        die(){
	}
}

If we are using destructor maybe die ?

from eo.

NikoGJ avatar NikoGJ commented on July 17, 2024

I agree in favor of making a constructor as a method/message
The same goes for desctructor but why would you want to destruct objects ? (except for technical implementation reasons)?

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024

@moriline I said die too, but I prefer create and destroy now.

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024

@NikoGJ

...why would you want to destruct objects ? (except for technical implementation reasons)?

If you want that GC — or ref-counting, whatever — release the object right now, you call the destructor.

from eo.

mdbs99 avatar mdbs99 commented on July 17, 2024

@Tertioptus it will not be mandatory to call the destructor directly, only if you want.

About "create/release" vs "create/destroy", I choose the last one.
If everybody likes "release", so my vote would be "new/release".

from eo.

yegor256 avatar yegor256 commented on July 17, 2024

How about up/down?

from eo.

yegor256 avatar yegor256 commented on July 17, 2024

How about +/-?

from eo.

yegor256 avatar yegor256 commented on July 17, 2024

Do we need an open vote here? :)

from eo.

Hronom avatar Hronom commented on July 17, 2024

@yegor256 definitely need a vote if you dont creating language only for yourself...

Well newest IDE have autocompeltition, so I'm not worried about long names like: constructor/destructor, create/destroy

from eo.

sergiofigueras avatar sergiofigueras commented on July 17, 2024

Hello guys :),

I'm coming just now for that discussion, but lets try to add something.

So, I dont see that a simple board vote will be enough for us, since the problem is not the voting itself, but our arguments to conclude a good approach. Also, I think that is a very special topic where we can't rely on a election for it.

use of CTor and DTor -> ok, it is nice. But as @alexpanov said, we should have keys as last options. It could be an alias for "constructor and destructor", for short. But it is not necessary to be a formal replacement for "Constructor and Destructor".
Constructor and Destructor -> nice too. Its a well established convention and honestly it expresses the correct idea of it.
Before and After -> it have other meanings in other languages and frameworks.
up / down -> doesnt see that it bring us a real value, its quite hard to understand the point of it.

  • / - -> how operators overloading will be treated in EO? Can we do a sum of two different objects? Ex User.new("a") + Group.new("b")? And if I want to overload this "+" operator inside two different classes?

I think that our main concerns on it should be:
1 - use words first, keys only if it is necessary
2 - Usage of words that are not used in different languages with different approaches (like Before and After).

So, I would suggest to use Constructors and Destructors formally and CTors and DTors just as good nicknames and see what happens in the meanwhile. :)

from eo.

nqafield avatar nqafield commented on July 17, 2024

@sergiofigueras I do actually kind of agree. We could do with collecting the best arguments together for each proposed case. But then eventually we would still have to vote. (Unless Yegor vetos it, which I wouldn't particularly mind.)

But all of that is quite a long-winded process. I wouldn't mind having a quick vote for now and then going with something for a bit until we make a proper decision.

from eo.

yegor256 avatar yegor256 commented on July 17, 2024

@pa9ey I voted :)

from eo.

ixmanuel avatar ixmanuel commented on July 17, 2024

I think either "constructor" and "new" should be removed from EO, because it is a legacy concept. I don't see the "new" operator in the proposal, but the constructor is there. Therefore, I don't know what was the underlying concept that supports this decision, but I think that it is not consistent: new-constructor came from the same kind of thinking (thinking in terms of how computers work).

If we think that objects are on a stage, they appear as players that interact with each other, but they do not need to be born in each scene. They only need to appear on the scenes that are required.

These actors also require resources, e.g., clothing, tools, that already exist but they don't need to create their clothes each time that they come on the scene. Also, if both players need to collaborate to perform as a giant, they don't born again in order to form the structure.

Maybe "init" can resolve it.

from eo.

Tertioptus avatar Tertioptus commented on July 17, 2024

Borrowing your scenario, I believe that the constructor is the parameter interface to which the director interacts with, and the method parameters are the interface for the other actors. Such that during boot strapping of the app, the monolithic global application entity creates all of the objects, composing them via constructors. Post-creation, the objects interact(communicate) with each other via method parameters.

from eo.

nqafield avatar nqafield commented on July 17, 2024

@ixmanuel I agree that they don't need to be "born" each time. But, if we must use the stage production analogy, there is often a "cast list" at the start of the play. They must at least be described. The "Dramatis personæ", the "actors", are introduced. Are you just arguing about names?

How do you describe what an object is? What it encapsulates? With a special method called init?

Is that all you mean?

from eo.

stain avatar stain commented on July 17, 2024

from eo.

stain avatar stain commented on July 17, 2024

from eo.

ixmanuel avatar ixmanuel commented on July 17, 2024

@Tertioptus
Yes, what we currently name as a constructor, is an interface and the place where initialization occurs, that is, the beginning of an act (beginning could be a good name but is not different from init that is short). With this reasoning we could try other words: input, require, use, collaboration. The parameters come from the mathematical domain and are certainly inputs to the function. In our case, they are also inputs or collaborators.

@pa9ey
Yes, it is only about naming. But naming accordingly with the "EO" principles as @stain described:

if EO objects are truly immutable, and constructors can't do any
work (beyond constructing), then it should be a runtime implementation
detail

from eo.

ixmanuel avatar ixmanuel commented on July 17, 2024

@yegor256 has proposed "ctor" and "dtor", how do you see? "init" and "free".

from eo.

yegor256 avatar yegor256 commented on July 17, 2024

@Tertioptus I'm closing, since EO doesn't have constructors anymore

from eo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.