Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
You gonna finish that?

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.



Auto API import

Import APIs from the internet by using them
(+1, -1)
  [vote for,

In most programming languages, most programs begin with import statements, to import code nearby the current program file or that have been downloaded by dependency management.

I think this solution is not good enough. Downloading code from the internet and getting it to work is a painful experience. If you've ever tried to download a Java application that uses Maven or Gradle, it breaks consistently. Or NPM or Ruby gems.

Today if you want to make a React application with create- react-app, you have to download at least 1,568 dependencies. You need a program (create-react-app) to generate an empty project.

I propose an alternative dependency management strategy. We have a registry of keywords and each library can register keywords, which are entrypoints to APIs. We have a global namespace for APIs. You're not allowed to use APIs that are reserved.

We can produce an API search server by spidering codebases for unique exported symbols. These are what would be reserved.

You would get a warning if you try write code that tramples an existing API.

When a program is interpreted or compiled, the central registry for the symbol key word is looked up and matching APIs are found and downloaded to the system.

Alternatively an API can be searched for based on API call patterns.

You don't need import statements anymore.

I can just use React.createElement and have React pulled in automatically.

chronological, Mar 07 2020

Python proof of concept https://github.com/...ire/importless-lang
How package exports can be looked up to generate imports [chronological, Mar 07 2020, last modified Mar 08 2020]


       //We have a registry of keywords//   

       Who's "we", and what motivates the many stakeholders to play by these rules?
pertinax, Mar 07 2020

       There would be an API search server which is a registry of APIs. This is where queries would go to satisfy requirements.   

       I imagine APIs uploaded to NPM and Maven could be spidered for symbols and turned into a keyword-registry.
chronological, Mar 07 2020

       a DNS for libraries could be an interesting idea. Actually Gradle accomplishes something akin to this, and allows you to have directives that override where to get the librrary
theircompetitor, Mar 07 2020


back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle