elements icon indicating copy to clipboard operation
elements copied to clipboard

margin/align name inconsistency

Open Xeverous opened this issue 5 years ago • 10 comments

I just realized there is align_left, align_right etc but also left_margin, right_margin. Is this intended? IMO it would be good to have everything spelled one way.

Xeverous avatar Jun 10 '20 14:06 Xeverous

Good point. What do you suggest? margin_right sounds kinda awkward. left_align sounds OK. Either way, this change will involve a lot of work on current apps using it. How about supporting both synonyms?

djowel avatar Jun 10 '20 14:06 djowel

I have mixed feelings about supporting both. thing_left, thing_right sounds most reasonably for me because most code is going from most significant to least significant (eg namespace::sub_namespace::func, struct.inner_struct.member, element.margin.top = ..., element.margin.right = ...).

Xeverous avatar Jun 10 '20 14:06 Xeverous

OK, but how about vtile, htile, etc.? Also, in english, you call it "right margin" (a noun) No one calls it "margin right", unless it is a phrase: "margin at the right". So is align-left, "align" is not a noun, it is a verb. So that's the difference. align_left is basically a shortcut of the phrase "align the element to the left". "alignment" is a noun, and so "left alignment" can be a long-cut of "left align". What can I say, it is english...

djowel avatar Jun 10 '20 14:06 djowel

namespace::sub_namespace::func, struct.inner_struct.member, element.margin.top = ..., element.margin.right = ...).

It would probably be cool to have this syntax: margin.right, align.left, align.left.top

djowel avatar Jun 10 '20 15:06 djowel

namespace::sub_namespace::func, struct.inner_struct.member, element.margin.top = ..., element.margin.right = ...).

It would probably be cool to have this syntax: margin.right, align.left, align.left.top

Yes, that can be done, I think.

djowel avatar Jun 10 '20 15:06 djowel

It would probably be cool to have this syntax: margin.right, align.left, align.left.top

Yes, that can be done, I think.

I think I like this syntax a lot. It also solves my problem of combination. For example, align.left.top should be the same as align.top.left. For margins, it is very intuitive: margin.left(10).right(20) which has the same semantics as margin.right(20).left(10).

I've also been mulling about the alternative syntax for proxies. Examples:

box | align.top.left | margin(10, 10, 20, 20)

... compared to the current syntax:

align_top_left(margin(10, 10, 20, 20), box)

djowel avatar Jun 10 '20 16:06 djowel

I really like |. Let's go functional. I see a lof of potential library design space to be explored, and such element transformations are much more readable than f1(f2(f3(elem))).

Xeverous avatar Jun 10 '20 17:06 Xeverous

Now that more users are already using elements, if we do this, it is time to use the [[deprecated]] feature. It is also probably time to have a stabilized version, on the way to v1.0 (perhaps v0.8). My idea is to move deprecated APIs in a separate directory, to keep the main API clean. Any API that is bound to change, that is already in the examples or already documented, should have a deprecation notice.

djowel avatar Jun 10 '20 23:06 djowel

New thing: docs mention:

// variant 1
vmargin({ top, bottom }, subject)

// variant 2
vmargin(top, bottom, subject)

// variant 3
top_bottom_margin({ top, bottom }, subject)

// variant 4
top_bottom_margin(top, bottom, subject)

But actually none of these functions exist. There are xside_margin and yside_margin instead.

Xeverous avatar Aug 17 '20 16:08 Xeverous

Good catch! I'll look into it ASAP.

djowel avatar Aug 18 '20 02:08 djowel

fixed in e2c2d22a6dcb2851a8b3cffa9e4157afb3b446ab

djowel avatar Feb 10 '24 07:02 djowel