• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Empty Record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Empty Record


  • Subject: Re: Empty Record
  • From: Emmanuel LEVY <email@hidden>
  • Date: Tue, 12 Apr 2011 15:37:39 +0200

For those interested, XMLLib.osax had to cope with that empty-record AppleScript problem.

Our choice: PlistNew (or: PlistNewChild) makes a plist for an empty dictionary, while PlistNew {} makes a plist for an empty list ("array").

Emmanuel

On Apr 12, 2011, at 2:53 PM, Luther Fuller wrote:

On Apr 12, 2011, at 4:46 AM, Nigel Garvey wrote:

Luther Fuller wrote on Mon, 11 Apr 2011 15:02:14 -0500:

This ought to be an easy question ...

	set emptyString to "" -- easy
	set emptyList to {} -- easy
	set emptyRecord to {} as record -- No! This does not work.

but, I have been trying for awhile now, and can't find a way to create
an empty record.
Does anyone know how to do this?

Hi, Luther.

set emptyRecord to {}

I don't know how it affects your plist, but in AppleScript, an empty
record and an empty list are the same thing.

The secret to understanding this problem is this phrase at the end of my original post:


The record will end up being written to a .plist file


An empty list is written to a .plist file as an 'array' (= list) not a 'dictionary' (= record).
In a .plist file, these are not the same thing and would cause confusion to any user of the application who edits the file with Property List Editor.


I will, therefore, continue to use my work-around. It reliably creates an empty dictionary.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Empty Record
      • From: Christopher Stone <email@hidden>
References: 
 >Re: Empty Record (From: Nigel Garvey <email@hidden>)
 >Re: Empty Record (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Empty Record
  • Next by Date: Re: Empty Record
  • Previous by thread: Re: Empty Record
  • Next by thread: Re: Empty Record
  • Index(es):
    • Date
    • Thread