Jump to content

Recommended Posts

  • Administrators
Posted

I've removed the Struct keyword from my working copy of the source. Still debating the dot notation for accessing DllStruct. I _guess_ it's no worse than using dot notation for ObjCreate. If you've not started messing with includes/libs yet then hang tight while I ponder. I you have then no worries as DllStructGet/Set will always work anyway.

  • Replies 641
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted (edited)

I don't agree that the new DllStruct notatation leads to any dangers that aren't already present. I can do the exact same thing with the old DllStruct that I can with the new one. The new syntax IMO is just easier to code and understand. The new syntax does not introduce any new data types that weren't in the old syntax as far as I can tell. Maybe I'm just missing the obvious here.

While true on a technical level, on a pratical level, there is a lot more danger. Within hours of the first beta containing Struct, people were using it to create "types" purely for storage. They were using it with no intention of ever passing that data to DllCall(). Can you do this without the Struct keyword? Sure, of course, but it's not as nice or as useful. It can be done with or without the Struct keyword and with or without the dot notation. But the more syntactic sugar you add to it, the more tasty it becomes to use it for the wrong reasons. If you want low-level memory management and types, use C++, because that's essentially what you're saying you want when you write code like below. This came across the mailing list this morning and is the exact rubbish that I knew people would write (2 years ago I said it would happen, or whenever DllStruct was being written):

Hi,

Last news about useful dots:

http://www.autoitscript.com/forum/index.php?

showtopic=19717&st=210&start=210

Both variants of the same:

(This one will be invalid in next beta!):

func AClass($One='', $Two='')

struct $AClass

char One[256]

char Two[256]

endstruct

$AClass.one = $One

$AClass.two = $Two

return $AClass

EndFunc

$MyClass = AClass('One',3)

MsgBox(0,'',$MyClass.one & ' ' & $MyClass.two)

$YourClass = AClass()

$YourClass.one = 2345.78

$YourClass.two = True

MsgBox(0,'',$YourClass.one & ' ' & $YourClass.two)

and this one (under debating):

func AClass($One='', $Two='')

local $AClassDef = 'char One[256];char Two[256]'

$AClass = DllStructCreate($AClassDef)

$AClass.One = $One

$AClass.Two = $Two

return $AClass

EndFunc

$MyClass = AClass('One',3)

MsgBox(0,'',$MyClass.one & ' ' & $MyClass.two)

$YourClass = AClass()

$YourClass.one = 2345.78

$YourClass.two = True

MsgBox(0,'',$YourClass.one & ' ' & $YourClass.two)

will be harmful in the future.

Valery

In addition, I'm not really sure that a variant-centric Struct keyword really offers anything other than a tiny bit of syntactic sugar. Is there much difference between:

Struct $TheClass
     MemberOne
     MemberTwo
 EndStruct

$TheClass.MemberOne = 1
$TheClass.MemberTwo = "Text"

And:

Enum $MEMBERONE, $MEMBERTWO, $MEMBERMAX
Local $TheClass[$MEMBERMAX]

$TheClass[$MEMBERONE] = 1
$TheClass[$MEMBERTWO] = "Text"
Edited by Valik
The forum is retarded.
Posted

While true on a technical level, on a pratical level, there is a lot more danger. Within hours of the first beta containing Struct, people were using it to create "types" purely for storage. They were using it with no intention of ever passing that data to DllCall(). Can you do this without the Struct keyword? Sure, of course, but it's not as nice or as useful. It can be done with or without the Struct keyword and with or without the dot notation. But the more syntactic sugar you add to it, the more tasty it becomes to use it for the wrong reasons. If you want low-level memory management and types, use C++, because that's essentially what you're saying you want when you write code like below. This came across the mailing list this morning and is the exact rubbish that I knew people would write (2 years ago I said it would happen, or whenever DllStruct was being written):

In addition, I'm not really sure that a variant-centric Struct keyword really offers anything other than a tiny bit of syntactic sugar. Is there much difference between:

Struct $TheClass
     MemberOne
     MemberTwo
 EndStruct

$TheClass.MemberOne = 1
$TheClass.MemberTwo = "Text"

And:

Enum $MEMBERONE, $MEMBERTWO, $MEMBERMAX
Local $TheClass[$MEMBERMAX]

$TheClass[$MEMBERONE] = 1
$TheClass[$MEMBERTWO] = "Text"oÝ÷ Ûú®¢×ßÙ§¢×b±¨+y觭*.jÖ¥Ú*¶¢iÛ-«r¢íý½éuè^­â¢z-ºÇ­ä­®ç-wR¶»¶G²Âݱ«ZVÞq«¬zØ^ÉØezwmé¬z[Þ²Úz«¨¶·
+Ú®¢Û¬yû¥~ð«HÁ«¢)àÇÚ­«ßÙ¢w®w¶¬yƧmëZéèºÕ¡jÒ7ök-ºjbè®+-¢G¦Ø^YR¶»¶v¦yاuìb§uÚ-*'²ç!jËaÆ®¶­sdvÆö&Â6öç7Bb33c·FuD$%UEDôâÒgV÷C¶çB&FÖ¶çB6öÖÖæC¶'FR7FFS¶'FR7GÆS·6÷'B&W6W'fVC¶çB&Ó¶çB7G&ærgV÷C° ¢b33c·D'WGFöâÒFÆÅ7G'V7D7&VFRb33c·FuD$%UEDôâ¢b33c·D'WGFöâä&FÖÒb33c¶ÖvP¢b33c·D'WGFöâä6öÖÖæBÒb33c¶@¢b33c·D'WGFöâå7FFRÒb33c¶7FFW0¢b33c·D'WGFöâå7GÆRÒb33c¶7GÆW0¢b33c·D'WGFöâå&ÒÒb33c¶&Тb33c·D'WGFöâå7G&ærÒb33c¶7G&æ

This is HUGE for me and gafrost is using this technique in the GUI code as well. As far as people using it for the wrong thing? Probably, but you can't stop that any more than you can stop people from perverting any of the other language features either. Stupid is as stupid does, but don't punish the rest of us for the sake of a few morons. :)

Auto3Lib: A library of over 1200 functions for AutoIt
  • Administrators
Posted

This is HUGE for me and gafrost is using this technique in the GUI code as well. As far as people using it for the wrong thing? Probably, but you can't stop that any more than you can stop people from perverting any of the other language features either. Stupid is as stupid does, but don't punish the rest of us for the sake of a few morons. :)

I wouldn't say it's HUGE :D It's the difference between these:

$tButton.Bitmap  = $iImage
ƒo݊÷ Ù«­¢+Ø)±±MÑÉՍÑM•Ñ…Ñ„ ˜ŒÀÌØíÑ ÕÑѽ¸°€™ÅÕ½Ðí  ¥Ñµ…À™ÅÕ½Ð찀˜ŒÀÌØí¥%µ…”¤(
Posted

I wouldn't say it's HUGE :) It's the difference between these:

$tButton.Bitmap  = $iImage
oÝ÷ Ù«­¢+Ø)±±MÑÉÕÑMÑÑ ÀÌØíÑ ÕÑѽ¸°ÅÕ½Ðí  ¥ÑµÀÅÕ½Ðì°ÀÌØí¥%µ¤(
My stuff is already reverted back to Get/Set and been submitted.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted

The "Struct" keyword and associated helpfile do lend to misunderstanding and abuse. The abuse of the keyword is a moot point, of course; people will find a way to abuse anything you give them. Having a keyword for Struct makes no sense, however, if it's intended to be limited to DLL structures.

If what we're after is syntax sugar, I could find a use for a properly-intended Struct keyword, you betcha.

If that's not wanted, toss out the Struct keyword as-implemented. Leave in the dot notation for Dll structures, though, because it makes coding them (and reading code using them) so much easier.

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Posted

I wouldn't say it's HUGE :) It's the difference between these:

$tButton.Bitmap  = $iImage
oÝ÷ Ù«­¢+Ø)±±MÑÉÕÑMÑÑ ÀÌØíÑ ÕÑѽ¸°ÅÕ½Ðí  ¥ÑµÀÅÕ½Ðì°ÀÌØí¥%µ¤(
Probably not HUGE to do that one time. How about doing that multiple times for 1,100 API calls? That's HUGE. :D
Auto3Lib: A library of over 1200 functions for AutoIt
  • Administrators
Posted

3.2.3.13 (4th May 2007) (Beta)

- Removed: Struct keyword and dot notation for accessing.

- Doc updates

- Some speed improvements in the expression parser. Should be small increases in _all_ scripts but lines containing expressions with large string should be much faster.

I'm intending this to be the last beta, then a couple of RC versions and then a release. Please test accordingly :)

  • Administrators
Posted

You can download from http://www.autoitscript.com/autoit3/files/beta/autoit/

3.2.3.14 (6th May 2007) (Beta)

- Added: Support for virtually all file formats (UTF16 LE/BE, UTF8) in scripts and File functions.

- Fixed: Possible Aut2Exe crash with #cs/#ce blocks.

Would appreciate those that are able to test out the file format stuff and make sure it's working correctly.

Posted

It's hard to keep up with the updates nowdays :D Keep up the good work :)

BTW: UPX 3.00(Final) was out a few days ago. It would be nice to have that one included, with the option to use lzma compression (a lot better compression ratio than NRV) from the Aut2exe.

  • Administrators
Posted

Jon,

...I forgot to mention it... To activate LZMA compression with UPX, the option "--LZMA" has to be used.

ex: upx --lzma "e:\myfile.exe"

I'll probably add the option in a future version, but the decompression is 30 times slower for exes with LZMA which is something to take into account.
Posted (edited)

I'll probably add the option in a future version, but the decompression is 30 times slower for exes with LZMA which is something to take into account.

Since Autoit Version 3.2.3.3 the AutoItX3.lib has disapeared form the installation.

Is it possible to have the right version for Autoit V 3.2.4.0-rc1 and V3.2.3.14

Thanks in advance because it's fault me for a programm

Edited by LOULOU
Posted

I'll probably add the option in a future version, but the decompression is 30 times slower for exes with LZMA which is something to take into account.

It sound worse that it is. On my old computer with an AthlonXP 1800+ does mame.exe decompress in about 2 seconds, when compressed with LZMA8 from about 28MB to about 6MB.

Posted

It sound worse that it is. On my old computer with an AthlonXP 1800+ does mame.exe decompress in about 2 seconds, when compressed with LZMA8 from about 28MB to about 6MB.

I knew about UPX 3.0 prior to your post and chose to say nothing as the virus making script kiddies would use the default install of UPX 2.01 and others had choice with using UPX 3.0.

With your push to have UPX 3.0 LZMA as default, then the script kiddies get the best for their scripts. Instead of the concern for AutoIt to do the LZMA for you, why don't you do it yourself in light that you have a slightly different packing routine then the default which may avoid the antivirus scanners false positives.

Posted

- Fixed: Possible Aut2Exe crash with #cs/#ce blocks.

Works fine so far with all the scripts that didn't compile with 3.2.3.13.

Many thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...