C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Alternative Free Function Calling Syntax.

From: Simon Schröder <dr.simon.schroeder_at_[hidden]>
Date: Mon, 29 Sep 2025 06:36:56 +0200
Would this work only with user-defined types or built-in types as well? One quick example would be pointers that could be used as iterators. But, this would then also allow this syntax for integers and floating point numbers. I‘m quite undecided if this would be good or bad thing.

> On Sep 28, 2025, at 5:13 PM, Bad At The Game via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> 
> Hi, I tried to take another approach at UFCS, Here
>
> https://github.com/ZXShady/proposals/blob/main/alternative_free_function_call_syntax.md
>
> It isn't professionally written I tried my best.
>
> I like free functions but I don't like them syntax wise, I prefer left to right reading in most cases than inside out and sometimes left to right at same time.
>
> ```cpp
> auto collisions = getCollisionBoxes(expanded(translated(aabb, position), vel), dimension, block_registry);
> ```
>
> this is hard to read but I don't want to have intermediary variables that have no meaningful names.
>
> While with that proposal it would allow
> ```cpp
> auto collisions = aabb.
> .math::translated(position)
> .math::expanded(vel)
> .gameLogic::getCollisionBoxes(dimension, block_registry);
> ```
>
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-09-29 04:37:14