473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 954

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

Similar topics

0
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...
9
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...
1
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...
6
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 ...
13
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...
15
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
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
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(); } //...
4
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.