capnproto / capnproto-dlang

Cap'n Proto in pure D
Other
19 stars 6 forks source link

Syntax sugar #5

Closed trikko closed 6 years ago

trikko commented 7 years ago

Why doesn't it generate something like:

obj.name = "hello"
obj.sub.name = "hello"

instead of:

obj.setName("hello")
obj.getSub().setName("hello")

And

people[0] 

instead of :

people.get(0)

?

ThomasBrixLarsen commented 7 years ago

It might in the future.

opIndex is already supported for lists.

kookman commented 7 years ago

I've prepared a PR which addresses this. You can see the changes in my fork. Are you interested in a PR?

kookman commented 7 years ago

@trikko you could try this now and see what you think.

trikko commented 7 years ago

Sounds good! :+1:

timotheecour commented 6 years ago

FWIW, https://github.com/msoucy/dproto (protobuf in D) does that syntax sugar and it makes it much more usable

ThomasBrixLarsen commented 6 years ago

I forgot to close this half a year ago.