Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I don't think we need "copy" keyword #20

Closed
yegor256 opened this issue Nov 17, 2016 · 17 comments
Closed

I don't think we need "copy" keyword #20

yegor256 opened this issue Nov 17, 2016 · 17 comments

Comments

@yegor256
Copy link
Member

Looks like copy keyword is redundant. I'm suggesting this:

type Point:
  Point moveTo(int x, int y)
object cursor(0, 0) as Point:
  Number @x
  Number @y
  Point moveTo(int x, int y):
    cursor: # here we COPY an object
      plus: @x, x
      plus: @y, y

No need to use copy at all. Just type and object are the keywords we need. What do you think?

@DronMDF
Copy link

DronMDF commented Nov 17, 2016

I do not understand how to create a number of different objects of the same type.

type Person:
    ....
object yegor256 as Person:
    ...
object dron as Person:
    ...

dron is not a copy of yegor256...

@yegor256
Copy link
Member Author

yegor256 commented Nov 17, 2016

@DronMDF you create one object first, and call it, say somebody. Then, you copy yegor256 and dron from it:

type Person:
    ....
object somebody("noname") as Person:
    ....
yegor256("Yegor Bugayenko")
dron("Andrey Valyaev")

See?

@DronMDF
Copy link

DronMDF commented Nov 17, 2016

Where is specified, that yegor256 it is Person or copy of somebody?

yegor256("Yegor Bugayenko")

somebody is ok.
object somebody("noname") as Person:

But all behavior inside of somebody.
yegor256 is specific version of somebody.. Is where it write?

@yegor256
Copy link
Member Author

@DronMDF I didn't understand the question(s). Can you re-write the first one again please?

@DronMDF
Copy link

DronMDF commented Nov 17, 2016

Sorry. :(

yegor256("Yegor Bugayenko")

Is where object type? How can i find it?

Another example:
string("Hello, world!")

What is the "string"? Type, object or object instance name? I can't understand.

@mdbs99
Copy link
Contributor

mdbs99 commented Nov 17, 2016

@yegor256 and @DronMDF
The first syntax is wrong.
What about this?

type Person:
    ....
object somebody("noname") as Person:
    ....
object yegor256("Yegor Bugayenko") from somebody
object dron("Andrey Valyaev") from somebody

@mdbs99
Copy link
Contributor

mdbs99 commented Nov 17, 2016

About string I suggest this:
object str("Hello, world!") as String

@DronMDF
Copy link

DronMDF commented Nov 17, 2016

@mdbs99:
Where prototype?

object hello("Hello, world!") from string

@mdbs99
Copy link
Contributor

mdbs99 commented Nov 17, 2016

@DronMDF you're right.
So, another syntaxe, a little bit different:

type String:  // a built-in type
...
object string as String
object hello("Hello, world!") from string

The "prototype" will be string, ie, an object that implements String.

@DronMDF
Copy link

DronMDF commented Nov 17, 2016

Hello world example should be look differ.

@mdbs99
Copy link
Contributor

mdbs99 commented Nov 17, 2016

@DronMDF I think so.

@yegor256 what do you think?

@nqafield
Copy link
Contributor

nqafield commented Nov 17, 2016

@mdbs99 Yeah, I'm not exactly sure I follow what's going on with all of this. I don't understand Yegor's comment/example above. I would've expected something like this:

type Person:
    ....
create person("noname") as Person:
    ....
yegor256 = person("Yegor Bugayenko")
dron = person("Andrey Valyaev")

Except that there doesn't appear to be a need for "variables" in this scheme, so he can't have meant exactly that.
(I'm catching up on lots of reading of issues and comments at the moment so that's the best I can do.) :)

@yegor256
Copy link
Member Author

hey guys, we won't have variables, keep this in mind!

yegor256 pushed a commit that referenced this issue Nov 17, 2016
@yegor256
Copy link
Member Author

@pa9ey please, review the latest version of README, I've made many changes a few minutes ago

yegor256 pushed a commit that referenced this issue Nov 17, 2016
@DronMDF
Copy link

DronMDF commented Nov 17, 2016

type Person:
    ....
person("anonymous") as Person:
    ctor(String name)

And later, names is not need. No variables! Ok.

person: "Yegor"
person: "Andrey"

Or

person: string: "Yegor"
person: string: "Andrey"

I'ts right syntax?
string is need? Or is this implicit?

@yegor256
Copy link
Member Author

@DronMDF that's a good question about String, I will explain it now in README

yegor256 pushed a commit that referenced this issue Nov 17, 2016
yegor256 pushed a commit that referenced this issue Nov 17, 2016
yegor256 pushed a commit that referenced this issue Nov 17, 2016
yegor256 pushed a commit that referenced this issue Nov 17, 2016
@yegor256
Copy link
Member Author

yegor256 commented Dec 6, 2016

No copy keyword any more, I'm closing this ticket

@yegor256 yegor256 closed this as completed Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants