Embedding questions

Olaf Appelt tholap at compuserve.com
Fri Dec 10 15:31:15 EST 1999


Hi Kevin,


> >Shall I take that as a recommendation that I shouldn't use Python for
what I
> >need?
>
> Nope, just have to change your paradigm a bit.

Personaly I have no problem with that. The problem is that I have to fullfil
some constraints. I  currently have a working solution that is easy to use
for the target audience (looks a lot like Basic), but it hard to maintain.
It's sort of a self-built interpreter. Minimalistic, but sufficient for our
needs.
Yet, if could realize the needed functionality on top of something like
Python, maintainance would become much easier.

One solution is to keep our Basic dialect, but have a much simpler compiler
that simply reformats everything into Python. That way I have no problem
with Pythons syntax, but can still profit from its interpreter.
Yet, not having to maintain that superficial grammer would be even nicer?
:-) (I guess I'm lazy)

> >class Currency
> >...
>
> >c = Currency ()
>
> >c = 5
>
> >The above, if I got this correctly would make c first an instance of
class
> >Currency and then re-assign that name to a different variable of type
> >integer.
>
> I think you're abusing operator overloading by saying c=5, and expecting c
to
> maintain other state information, it's not really assigning 5 to 'c', but
> assiging some single attribute of c to 5,
>
> If I had:
> c = Currency()
> d = Currency()
> .
> .
> c = d
>
> What would you expect/want to happen?

Depends upon the language. ;-)
In Python *I* would expect c now being a second reference to what d
references. While the instance formerly known as c is now unreferenced and
can be collected.

The users of my language would expect c to have now the same numerical value
that d has, but still preserving all state information that was associated
with c.
That's my problem. The variables in this language carry a set of
informations and only one value is changed by assignment.

> I had trouble with not being able to overload the assignment operator when
I
> first started learning Python.  After awhile now, I don't miss it.  I
guess that
> will change as I start doing more C++.

I'm not suffering from paradigma deficiency syndrome. ;-)
I experienced a lot of languages and am therefor used to different
paradigmas and willing and able to adapt my POV.

I'm aware that I'm trying to do something with Python for which it was not
built. Yet, given the realistic alternatives, Python is otherwise very high
on my list.
If I can find no better way, I'll go with the Python interpreter plus
PseudoBasic pre-compiler solution.

Thanks for your input.

Olaf






More information about the Python-list mailing list