Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8902121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:32:00+00:00 2026-06-15T01:32:00+00:00

Python, and others, use the import technique of getting external functionality. C, and others,

  • 0

Python, and others, use the import technique of getting external functionality.

C, and others, use include (and, eg C++, has attendant namespace headaches).

What is the reason to pick one over the other (or use both like Objective-C can) in designing a language?

I see Apple is proposing some updates/changes via a paper to LLVM, and wonder why the differences exist.

clarification based on @delnan‘s answer

Given that there are multiple ways to implement import (of which I was unaware until his answer), what is the overall benefit of !include versus include? The import technique seems to only find individual subcomponents based on pathing given to them (at least in Python – whose [apparent] method is the only one I know).

How do other uses of the import methodology differ yet from that? When would using the ‘old style’ include method make sense in modern language design and implementation (if ever)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:32:01+00:00Added an answer on June 15, 2026 at 1:32 am

    The approach of C, which C++ and Objective C simply inherited, is very simple to define and implement (in a nutshell, “when encountering an #include, replace it with the contents of the file, and continue”), but has serious problems. Some of these problems are named in the presentation you’ve seen (and elsewhere). There are idioms and best practices (also discussed in that presentation and elsewhere) and minor extensions (#pragma once, precompiled headers) which alleviate some of the problems, but at the end of the day, the approach is fundamentally too limited to handle what software engineers have come to expect of a module system. Pretending it does what more recent alternatives do (see below) is a quite leaky abstraction.

    Nowadays, everyone with an opinion on language design seems to agree that you shouldn’t do it if you can help it. C++ and Objective C didn’t have that choice due to the need for backwards compatibility (though both had and still have the choice to add another mechanism, and Objective C did it). It is “fair for it’s day”, in that it was a rather good decision back when it was made (it worked well enough, and it still kinda works if you have discipline), but the world has moved on and settled on better ways to split code into modules, then pull it back together. (Note that such ways already existed back in the early C days, but apparently they didn’t catch on for a while.)

    What you describe as “the” import technique is actually a pretty large design space. Many module systems are almost, but not quite, entirely unlike each other – and the rest still has enough subtle differences to ruin your day. It can be anything from just executing the imported file in a new scope (Python, PHP) to fully-blown ML-style functors. There are some similarities, in that all these module systems give each “module” (whatever that means in the respective system) their own scope/namespace, (usually) permit separate compilation of modules, and generally go out of their way to fix the problems of C-style textual includes (or whatever other problem the creator sees with the alternatives). That’s about as much as one can say in general.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Python EPD Traits I can keep variables that depend on others up to
I'm using Python 2.x [not negotiable] to read XML documents [created by others] that
Python's urlparse function parses an url into six components (scheme, netloc, path and others
i've a small user defined function in python, say fib(n), how do i use
I'm trying to use with Python a COM server which expose only the IDispatch
I'm trying to use python to sftp a file, and the code works great
I need to use python on a big server where I don't have root
I have a problem with python module import. I installed django (this can be
How can a Python program easily import a Python module from a file with
I've seen other Python programmers use defaultdict from the collections module for the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.