473,811 Members | 3,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

type declarations, interfaces, etc as program information composition

I just read Guido's http://www.artima.com/weblogs/viewpost.jsp?thread=86641
"Adding Optional Static Typing to Python -- Part II"

and I it struck me that if you step back to a more distant perspective,
you can see specific source syntax proposals as a special case of composing
program information, and I wondered if the coupling inherent in editing
a particular source to add information is always best.

Certainly it makes for a handy single-file package of info, unlike C
source and header files for example. Not to mention make files and the
plethora of information they can direct the composition of.

But, e.g., what is the best way to tell python that I intend to use
its "sum" builtin to add a list of integers, so that it can figure out
that it will be safe to generate machine code using 32-bit integers?

Should I have to code a new version with static type declarations?

What about stuff I've alrady written, that I'm pretty sure would work
fine with floating point, but which has no type information? Should I
have to edit that code, that may be in CVS, in order to tell python
to generate more specialized code?

Or would it be useful to have a specialization tool that I can tell
what to do with what existing sources. IOW a pythonic make of some sort.
What if specialization info for mylib/myutil.py were in currproj/myutil.pyspec
and a pymake or pycc tool knew how to do the right thing?

A .pyc file would contain the combined information and specialized code, and
a smart inspection tool could show the combined source information in context
by going to the relevant sources of myutil.py and myutil.pyspec etc. So the
argument that all needs to be in the same file for easy reading is not absolute.

Of course, it would be good if the combined presentation format were also
a legal input format, for those who want a single specialization in a single file.

A specialization tool could well raise exceptions saying a particular source
module def foo... can't be specialized as you want, because e.g., it returns both
strings and ints, and your interface info says foo(int, int) -> int.

Anyway, I consider the Lego-like composability of python programming elements
to be one of python's greatest attractions. I hope Guido can figure some way to
let us snap in type info without filing existing knobs into new shapes.

Regards,
Bengt Richter
Jul 18 '05 #1
0 970

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1852
by: Marc te Vruchte | last post by:
Over the past years i've been in contact with the same problem a number of times, creating a graphical user interface on complex XML documents. Personally these solutions have never been satisfactory to me as a developer. I am not sure if this is caused by the way i've approached the problem or that it is the maturity of current day XML technologies. Let's say we are developing Form interfaces on complex XML documents which have a...
9
2318
by: Code4u | last post by:
My colleagues and I have been discussing techniques for implementing interfaces in C++. We're looking for a mechanism similar to COM's QueryInterface, in which a certain types of objects can be queried, at run-time, for a particular interface and if it is supported, a pointer or reference to that interface passed to the caller. Two possible implementations came up, multiple inheritance and composition. Using MI the class multiply inherits...
1
11533
by: Jeff | last post by:
Hello everybody, I have a question concerning function declarations. When exactly do you have to declare functions if you want to use them? I have two functions main() and foo(), respectively defined in main.c and foo.c. There is no declaration of foo() inside main.c, but main() calls foo(). If I compile both files (using gcc's -c option), and then link them, main() calls foo() without any problem. How come ? Wasn't I suppose to declare...
6
2694
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is completed, for all declarations of that type, by ^^^ # declaring the same structure or union tag with its defining # content later in the same scope. ^^^^^ (6.2.5#23)
13
2262
by: imutate | last post by:
Hi, I am migrating some std::vectors to use a template instead, but I get an incomplete type error in a struct declaration. #include <vector> template < typename T > class Vec : public std::vector< T { public: Vec():Vec<T>() { }
15
7634
by: shuisheng | last post by:
Dear All, Assume I have a class named Obj. class Obj { }; And a class named Shape which is derived from Obj. class Shape: public Obj
23
4618
by: Dave Rahardja | last post by:
Since C++ is missing the "interface" concept present in Java, I've been using the following pattern to simulate its behavior: class Interface0 { public: virtual void fn0() = 0; };
13
2126
by: interec | last post by:
I have some code in Java that I need to translate into C++. My Java code defines a class hierarchy as follows: // interface IA public interface IA { public abstract void doA(); } // interface IB
4
1629
by: sip.address | last post by:
Hi there, When creating interfaces and implementations, the usual thing is doing somethign like class Interface { public: virtual void f() = 0; virtual void g() = 0; };
0
9731
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10405
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5556
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5697
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4342
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.