Are links deprecated in Docker Compose?

According to the Docker docs, links are described as “legacy”. In particular, there’s this warning:

Warning: The --link flag is a deprecated legacy feature of Docker. It may eventually be removed. Unless you absolutely need to continue using it, we recommend that you use user-defined networks to facilitate communication between two containers instead of using --link. One feature that user-defined networks do not support that you can do with --link is sharing environmental variables between containers. However, you can use other mechanisms such as volumes to share environment variables between containers in a more controlled way.

Contrariwise, Docker Compose also has a “links” feature, which is not deprecated according to the Docker Compose docs.

Is there any relationship between the Docker “Legacy container links” feature and Docker Compose’s “links” section? If so, why are they deprecated in one and not in the other? If not, why are they both called “links”?

As I understand “link” flag deprecated in “docker run”, but docker-compose will continue use “link” but using “docker network connect”.

Usage:	docker network connect [OPTIONS] NETWORK CONTAINER

Connect a container to a network

    Options:
          --alias stringSlice           Add network-scoped alias for the container
          --help                        Print usage
          --ip string                   IP Address
          --ip6 string                  IPv6 Address
          --link list                   Add link to another container (default [])
          --link-local-ip stringSlice   Add a link-local address for the container