Skip to content

Avoid connecting properties for now#445

Closed
tjpalmer wants to merge 2 commits into
connected-qnamefrom
connected-qname-accessors-only
Closed

Avoid connecting properties for now#445
tjpalmer wants to merge 2 commits into
connected-qnamefrom
connected-qname-accessors-only

Conversation

@tjpalmer

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Tom <tom@temper.systems>
put("std/temporal.type Date.year", Like.core("Date::getYear"))
put("std/temporal.type Date.get day()", Like.core("Date::getDay"))
put("std/temporal.type Date.get month()", Like.core("Date::getMonth"))
put("std/temporal.type Date.get year()", Like.core("Date::getYear"))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearer intent this way.

int32_t getYear(const std::shared_ptr<D>& d) {
return d->year;
return d->_year;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual fields have uglier names now.

And be-cpp currently makes public fields. We shouldn't do that. But even if we keep this organization the same, we could friend this helper code here for access.

internal fun connectedKeyForMember(member: MemberShape): String? = when (member) {
is MethodShape -> connectedKeyForMethod(member)
is PropertyShape -> member.connectedKey
is PropertyShape -> null // connect only through accessors methods for now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frontend things should go along with this, but that's TODO in this PR. This tmpl restriction at least limits backends from connecting properties themselves until we work more details out in the future.

"day" -> Value(today.dayOfMonth, TInt)
"_year" -> Value(today.year, TInt)
"_month" -> Value(today.monthNumber, TInt)
"_day" -> Value(today.dayOfMonth, TInt)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interpreter also has to use the private names.

@connected
public day: Int;
public get day(): Int { _day }
private _day: Int;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now all getters with private still-imu fields. Key is that the connection is specifically on the getters now.

Signed-off-by: Tom <tom@temper.systems>
@tjpalmer

Copy link
Copy Markdown
Contributor Author

Went with #446 instead because even though this one might be formally better, I like the fewer changes for now over there, and after frontend improvements (such as in #451?), some of this changes in this pr might not be needed.

@tjpalmer tjpalmer closed this Jun 30, 2026
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

Successfully merging this pull request may close these issues.

1 participant