• Welcome to Theos PowerBasic Museum 2017.

The compiler advantage

Started by John Spikowski, August 11, 2013, 07:20:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge

#45
Yes, something along these lines:


class cVariant

'   ' =====================================================================================
'   ' Initializes a VARIANT with a 32-bit integer value.
'   ' =====================================================================================
'   METHOD FromInt32 (BYVAL lVal AS LONG) AS VARIANT
'      LOCAL v AS VARIANT
'      LOCAL pv AS tagVARIANT PTR
'      pv = VARPTR(v)
'      @pv.vt = %VT_I4
'      @pv.lVal = lVal
'      METHOD = v
'   END METHOD
'   ' =====================================================================================

method FromInt32(long lval) as VARIANT
let v=new VARIANT
v.vt=VT_I4
v.vd.lval=lval
return &v
end method

'...

end class

cVariant cv

let v=new cv.FromInt32(42)
...

Theo Gottwald

#46
Quoteand PBers are ignoring them.

To me this stuff has something together with chinese characters.
It looks nice, some look like a tree, some like a box but i have no idea why its just at that place.

The programming paradigm behind these so called COM-Objects is so far from "Normal" (NOT object oriented programming),
that the switch between these two needs a total reset in the programmers brain possibly.
At least i could not yet get the idea behind these COM-Objects.

Why should i use Variant for everything if a BYTE is enough?
We just come from a school where we learned that we do not waste memory if we do not have to.
If i can programm it hyperfast, i have a hard time to choose the slow way.
If i can make it DLL independent, i will not use a MS DLL that can be missing or changed in a further OS.

Only if there is no way around i am jumping in that COM bath at least currently.
It looks all so bloated to me. People who learn programming this way will see that different.
We learned in byte-byte Assembler at a time when 8 KB were a lot and with 32 kb you had been the King :-).
Now today things changed and it will take time to understand the new wasteful paradigms.

José Roca

You still don't have the slighhtest idea of what low-level COM is. You're talking of Automation. They are very different animals.

Theo Gottwald

You said in one sentence what i said flowerly in an article  ;D
At least you see that i try to be more diplomatic.

John Spikowski

The world is over populated with brown nosed sheep. Pick something you're good at and master that. I think José's include files is an excellent example of refined passion in action.

José Roca

A total waste of time, as you can see. Pray for Metro failure, because its API is all low-level COM. Time to retire.

John Spikowski

That still doesn't change the fine effort and ongoing resource (as Charles mentioned) to how COM works.

I wish PB could figure how to keep a forum up (seems down once again) before spending any more time on the back room projects we are suppose to start getting excited about.


Charles Pegge

All typeless scripts need something like a variant, so that variable types may be set in run-time, and automatically coverted from one type to another when necessary.

I would be quite tempted to manage variant setting in a single function with a select-case block, rather than use separate methods for each type. At the binary level, case selection is very fast, and you can put the most commonly used types at the top of the case list.

John Spikowski

#53
Why everyone is dreaming how great it would be to see José's include files working with O2, I thought I would give you guys something to play with on your Android device.  8) 



Note: The screen copy and reduction didn't do what this really looks like justice.

more ...

Frederick J. Harris

Quote
Only if there is no way around i am jumping in that COM bath at least currently.
It looks all so bloated to me. People who learn programming this way will see that different.

I personally don't feel bloat is a necessary part of COM Theo.  To my mind, COM is just a specific architecture with a specific layout of such things as VTables, so on and so forth, that brings some advantages that non COM objects lack.  I think I figured out once what the added baggage was, for example, a visual control in custom control form compared to ActiveX Control form, and its only a few K (3 or 4 or 5 or something like that).  If you would implement all the ActiveX Control interfaces it would be a few more, but not that many. 

I know this is an often mentioned criticism of COM, but I'd have to say my experience substantiates what Jose has said many times about it as not being bloated.  Just to give the example I've been working with for the past couple years, lately I've been replacing the SIGrid custom control in my work apps with the COM based grid control I posted down on my board here.  The SIGrid control was a full featured grid control that came in 49K compressed.  My COM based grid control is 22K compressed.  I don't think of that as being bloated.

It seems to me bloat is more associated with the coder and the tools he/she uses.  It is a bit hard for some of us who started back in the late 70s or early 80s to tolerate some of the code one sees, that's for sure.   My unique circumstance is such that I'm not obligated to use bloatware or deal with it in any way, so I just avoid it as a matter of personal preference.

José Roca

If they tried from themselves, instead of talking from hearsay, they will realize how wrong they are. Anyway, if they are happy renouncing to the access of two thirds of the operating system, so be it. I no longer care.

John Spikowski

QuoteI no longer care.

Can you clarify that for me?

A. I no longer care about trying to convince PB programmers that COM is the framework Windows in built on?

B. I no longer care about COM programming and I'm ready to retire.

C. I need a vacation.


José Roca

A, B and C. If it doesn't happen something exciting, I have better things to do.

John Spikowski

#58
If you want fun and excitement, join us on the the OxygenBasic forum. Charles is more than a wizard behind the curtain and actually comes though with his promises of a better BASIC compiler. How does it feel to have the source of the compiler to do what you think is right?

In a way I've been where you are now. When the best of the best told me there was no hope left and wanted me give authorization to remove my daughter from life support, I told them they didn't try hard enough and I would find the way. My daughter is a functional quadriplegic and minus a lung but she is happy I didn't give up on her and that I found the one in the million second chance at life.

Moral of the story: There isn't anything you can't do if you try hard enough.


John Spikowski