Comments (26)
Drop semicolon - this is a good idea.
Only one expression per line.
from eo.
@mdbs99 why no semi-colons? won't it be difficult to parse this code?
We don't need it. See F#, GoLang, Python... is more elegant
I think it's better to stay as close to Java as possible. Or I'm wrong?
Maybe not, why? Let's do some different.
GoLang use the type after as Object Pascal.
@mdbs99 in your syntax I can't have a method with the name constructor, right?
@yegor256 yes, we can't.
from eo.
@mdbs99 hm... I think I agree (about non-Java syntax). Where did you get your syntax?
from eo.
@mdbs99 why this:
name(): String
instead of this:
String name();
I think it's better to stay as close to Java as possible. Or I'm wrong?
from eo.
@mdbs99 seriously I want the honest opinion about the syntax being discussed above like I would never like to review the code written above. At least the syntax shouldn't be completely alien.
from eo.
@mdbs99 why no semi-colons? won't it be difficult to parse this code?
from eo.
Here an example of copy
:
var dog = object Dog("Rex") { ... }
var lucy = object Dog("Lucy") from dog
Now you have lucy
, an object copied from dog
(Rex) but name was initialized using Rex's constructor.
from eo.
@mdbs99 in your syntax I can't have a method with the name constructor
, right?
from eo.
How to use delegation (see comments here)
type Stream { serialize() }
var b64 = object Stream(d: String) {
// implements base64
}
type Dog extends Run, Bark, Stream {
name(): String
sit()
}
var dog = object Dog("Rex") {
constructor (n: String) { var name = n }
name(): String { print (name) }
sit() { print ("sat") }
compose {
run from r1 implements Run
bark from b1 implements Bark
stream from b64 implements Stream(name())
}
}
print ("Dog in base 64: " +dog.stream.serialize())
from eo.
@yegor256
Everybody copy C++ or Java syntax. Let's move on.
A developer who loves Java won't like this new language, I suppose.
So, let's create a new language... a better one.
from eo.
we can take help from Scala too I like their idea of trait
and object
.
http://docs.scala-lang.org/tutorials/tour/classes.html
from eo.
@yegor256 nowhere, I invented when we talked on Gitter.
from eo.
@mdbs99 could you, pls, explaine this syntax
...
compose {
run from r1 implements Run
bark from b1 implements Bark
stream from b64 implements Stream(name())
}
...
E.g. here
run from r1 implements Run
what does this mean? What are run
and r1
?
from eo.
@mdbs99 also here
...
constructor (v: String) {
var value = v
}
...
What is value
? Is this local ctor variable or object field?
from eo.
run from r1 implements Run
This is a Object Pascal feature (but the syntax is different, see here).
Means you have a Object that could implement many interfaces, but you don't need to implement these methods, just delegate them for another objects.
what does this mean? What are run and r1?
So, in that syntax I've proposed run
is a property that will receive an instance that implements the Interface Run
, ie, the r1
object (declarated in first comment).
from eo.
What is value? Is this local ctor variable or object field?
Yes, looks ambiguous...
Maybe we can use @
like Ruby for all attributes, because is annoying to write this
for attributes but not methods — an inconsistency, IMO.
EDIT:
Now I remembered what I had thought: All variables inside a ctor is an attribute.
from eo.
@mdbs99 I like the idea about @
, here is the ticket: #10
from eo.
I like the def
keyword instead of var
. Sounds more object oriented to me.
And why not get rid of the equal sign when defining variables, and keep it only for comparisons ?
def name is String("Mattew")
return name = String("Johnny")
from eo.
@DronMDF I agree, we don't need semi-colons at all
from eo.
@monsieurluge check this out: #20
from eo.
@yegor256 I think this issue can be closed because people chose another syntax.
But, if we close this, I will start another issue to talk about composition to implement Types. What do you think?
from eo.
To be honest I think the syntax looks too verbose and too much indentation.
Int max(Int a, Int b):
if:
lessThan:
a,
b
b,
a
I am not a language designer but I would love to see something close to this:
if a lessThan b then b else a
from eo.
@vivekimsit I've suggested to use brackets, at first, because I guess most here likes Java. But after I've talked to use end
to delimit a block — like Ruby or Pascal (without begin
).
I still think that using end
is a better choice. That make possible to write as you said, in one line.
from eo.
I guess you talking about the syntax that use whitespaces, right?
from eo.
Int max(Int a, Int b):
if:
lessThan:
a,
b
b,
a
and
import org.eolang.cli
import org.eolang.printed
import org.eolang.string
cli:
printed:
string:
"Hello, world!"
from eo.
@mdbs99 we have a new syntax now
from eo.
Related Issues (20)
- Make XSD as powerful and as restrictive as possible HOT 1
- `PullMojo` and `ResolveMojo` are not proxy-aware HOT 1
- Move `eo-sys` to `eo-runtime` HOT 3
- File name too long HOT 4
- pom.xml:340-343: Enable PMD check for... HOT 2
- BytesOf.java:34-38: This class requires refactoring. As a... HOT 4
- Data.java:196-199: This method should be refactored... HOT 2
- Can we use some static analysis like Sonar in CI on PR? HOT 1
- Failed build: daily HOT 10
- Add `+rt node` meta to work with js compiler HOT 1
- merge smaller libs into this repo HOT 7
- Printing PHI Expressions Extremely Slow HOT 4
- list.eo:208-211: The object does not work. After moving... HOT 2
- PhPackage need update HOT 2
- BytesRaw.java:33-36: Method {@link BytesOf#shift} should... HOT 2
- align-test-classes.xsl:27-28: Add link to corresponding... HOT 2
- remove-high-level-inner-classes.xsl:27-28: Create... HOT 14
- map.eo:105-112: Find a way to link hash code and index of... HOT 2
- text.eo:313-315: Implement text.replaced object. This... HOT 3
- Replace `int` and `float` with `number` 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.