hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.48k stars 242 forks source link

Minor fixes in docs #1236

Closed jamadagni closed 2 months ago

jamadagni commented 2 months ago

https://github.com/hsutter/cppfront/blob/61e68bb3fe49d2755c8190b865d66331488a2b51/docs/cpp2/declarations.md?plain=1#L51

lamba → lambda

https://github.com/hsutter/cppfront/blob/61e68bb3fe49d2755c8190b865d66331488a2b51/docs/cpp2/objects.md?plain=1#L82

insert <<

https://github.com/hsutter/cppfront/blob/61e68bb3fe49d2755c8190b865d66331488a2b51/docs/cpp2/objects.md?plain=1#L71

End of long sentence: construction in the callee or caller?

jamadagni commented 2 months ago

Also

https://github.com/hsutter/cppfront/blob/8c9e8107aa2fb084a76b74584f9853d3bbd0efa3/docs/cpp2/functions.md?plain=1#L454

lamba → lambda

Should there be a global search replace for this? :thinking:

Ohkay the only one other place I found this is:

https://github.com/hsutter/cppfront/blob/8c9e8107aa2fb084a76b74584f9853d3bbd0efa3/include/cpp2util.h#L1312

[ :slightly_smiling_face: lamba in Hindi means tall, and I have had that word used to refer to my 6′3″ height :wink: ]

DyXel commented 2 months ago

You can/should open a PR if you have the time, first time contributors will need to sign a CLA, but if you plan on contributing more in the future its probably a good idea to do it early 🙂

jamadagni commented 2 months ago

@DyXel yes I can do that and have already forked the repo prior to this evening's post. [Not to mention would be a point of pride to have my teensy contribution included.]

End of long sentence: construction in the callee or caller?

But how about things like the above where I'm not sure?

DyXel commented 2 months ago

But how about things like the above where I'm not sure?

Asking is the right thing to do.

construction in the callee or caller?

In the callee, so this is correct. Essentially, any out argument in a function needs to be assigned to first, which would need to do the necessary operations to construct and/or set a meaningful value to the object, but this happens within the function, not outside of it. The next section explains it more clearly: https://hsutter.github.io/cppfront/cpp2/functions/.

hsutter commented 2 months ago

Thanks! I'll take a look at the PR, just sent you a CLA.

- that definite first use must be of the formobj = value;which is a constructor call, or else passobjas anoutargument to anoutparameter (which is also effectively a constructor call, and performs the construction in the callee).

End of long sentence: construction in the callee or caller?

In the callee. The callee ensures that the constructor is called for its out parameter if the argument isn't constructed yet (and performs the call), and that's what makes any function with an out parameter effectively a delegating constructor for that parameter.