Talk:Extract file extension: Difference between revisions

Content added Content deleted
(respond)
Line 50: Line 50:


:: That's why the specification says "For the purposes of this task", and the task allows showing a built-in standard library function that behaves differently. --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 16:32, 21 December 2017 (UTC)
:: That's why the specification says "For the purposes of this task", and the task allows showing a built-in standard library function that behaves differently. --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 16:32, 21 December 2017 (UTC)

== Use Libraries not Footguns ==

Practicing programmers should strongly prefer to use existing filesystem APIs to extract file extensions.

Why?

1. Doing this correctly depends on the operating system (OS).

2. Such OS APIs exist for a reason! Use them!

3. Generally speaking, handling strings correctly is harder than many programmers realize. There are many gotchas in doing this correctly.

4. You need to be smart about encodings and locales.

Therefore, for the sake of being *responsible* about what information Rosetta Code provides, it should do the following:

A. Make it abundantly clear that ad-hoc solutions are *not* applicable for real-world usage.

B. Point readers to the relevant APIs in their languages, operating systems, and libraries.