r/cpp • • Oct 24 '24

Why Safety Profiles Failed

https://www.circle-lang.org/draft-profiles.html
178 Upvotes

347 comments sorted by

View all comments

Show parent comment

1

u/germandiago Oct 28 '24 edited Oct 28 '24

It also shows something else: that it is impossible to implement a std library without rewriting it.

I mean:

  • std::function
  • std::move_only_function
  • std::function_ref
  • std::list
  • std::forward_list
  • vector
  • string
  • string_view
  • map
  • unordered_map
  • queue
  • stack
  • deque
  • all ranges header
  • all algorithms

And much, much more... that needs a spec, an implementation, debugging and all compilers to implement it. At least the big 3. Yes, just a detail without importance I guess...

2

u/Dalzhim C++Montréal UG Organizer Oct 29 '24

It also shows something else

What is « It » here exactly?

it is impossible to implement a std library without rewriting it

Same goes with profiles, you can't protect the user against all unsound uses of the standard library without changing its interface.

1

u/germandiago Oct 29 '24 edited Oct 29 '24

You could annotate it and take advantage of a lot of thi gs that have been done for years already with hardly touching the code.