Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions
This is the forum to discuss the Wrox book VBScript Programmer's Reference, 3rd Edition by Adrian Kingsley-Hughes, Kathie Kingsley-Hughes, Daniel Read; ISBN: 9780470168080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 6th, 2009, 01:54 PM
Registered User
 
Join Date: Jan 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question 3rd ed./Ch.8/p.215-216: Something ain't right here...

Hello:

I was reading through Chapter 8 (3rd edition) and noticed a short comment that struck me as 'strange' (but not necessarily 'impossible').

Here the text segment that I think may not be correct (very last paragraph on p.215):

"The Set syntax inside of the Property Set and Let is optional. Because you write directly to the Variant private property variable, you can use either. ..."

To test this statement I entered the code shown on pages 215 (and again on 216). Below I pasted the code (if anyone wants to try it out). I ran said code with and without the Set inside of the Property segments (alternatively commented-out). I can't get this to run WITHOUT the Set statement and therefore I was wondering if anyone on here could shed some light on this situation (perhaps referencing the proper MSDN source at the same time)?

Most appreciated,

AR.

Inline Attachment:


Code:
Dim objFileHelper
Dim objFSO

Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFileHelper = New FileHelper

'with 'Set' (works only with 'Set' in class below):
Set objFileHelper.FSO = objFSO

'without 'Set' (again, works only with 'Set' in class below):
'objFileHelper.FSO = objFSO

Class FileHelper
'write-only class
    Private m_objFSO
    
    Public Property Set FSO(objFSO)
        'Set m_objFSO = objFSO
        m_objFSO = objFSO
    End property
    
    Public Property Let FSO(objFSO)
        'Set m_objFSO = objFSO
        m_objFSO = objFSO
    End Property
    
End Class

Last edited by arar; January 6th, 2009 at 01:58 PM.
Reply With Quote
  #2 (permalink)  
Old January 7th, 2009, 12:53 AM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,652
Thanks: 3
Thanked 141 Times in 140 Posts
Default

That comment just doesn't make sense.

The code *INSIDE* the Property subroutine is just ordinary VBScript code and isn't really "aware" at all that it IS inside of a Property Set. The VBScript compiler just generates byte code tokens pretty much on a one for one basis and then, when those tokens are interpreted, they are just sent through a massive SELECT CASE (actually, "switch" in the C++ code) that sends the interpreter off to do the right thing. And the code for "SET" or the [implied] LET is the same no matter where the byte code is encountered.

I strongly suspect that this comment may have been cloned from a book about VB6. Since that language *IS* truly compiled, it's quite possible that it might be able to supply the "missing" SET automatically. But of course it's equally possible that this is just a plain flat goof.

Last edited by Old Pedant; January 7th, 2009 at 12:56 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Initial Comments - XSLT 2.0 3rd Ed. baryza Wrox Book Feedback 1 July 9th, 2007 07:18 PM
doubts on introduction of professional c# 3rd ed benraidertx BOOK: Professional C#, 2nd and 3rd Editions 1 June 1st, 2005 04:47 PM
Where did the Appendicies go? - 3rd ed AndrewGiles BOOK: Professional C#, 2nd and 3rd Editions 1 January 4th, 2005 07:04 PM
Expanding Forum to Cover Professional C# 3rd Ed jminatel BOOK: Professional C#, 2nd and 3rd Editions 0 July 21st, 2004 03:37 PM
CH 6 pg 216 Recursive Code wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 8 November 19th, 2003 06:53 PM



All times are GMT -4. The time now is 09:16 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.