if (typeof define !== 'function') { var define = require('amdefine')(module); }
define(['./deferred', './tools'], function(Deferred, tools) {

    return {
        asVal: asVal,
        create: create
    };

    function create(wyrmhole, mimetype, args) {
        var send = Deferred.fn(wyrmhole, 'sendMessage');
        return send(['New', mimetype, args]).then(function(spawnId) {
            return tools.wrapAlienWyrmling(wyrmhole, spawnId, 0);
        }).then(function(queenling) {
            queenling.destroy = function() {
                return send(['Destroy', queenling.spawnId]);
            };
            return queenling;
        }, function(error) {
            console.log("CREATE ERROR:", error);
            return Deferred.reject(error);
        });
    }

    function asVal(obj) {
        if (tools.isPrimitive(obj)) { return obj; }
        return { $type: 'json', data: obj };
    }
});

if (typeof define !== 'function') { var define = require('amdefine')(module); }
define(['./deferred', './tools'], function(Deferred, tools) {

    return {
        asVal: asVal,
        create: create
    };

    function create(wyrmhole, mimetype, args) {
        var send = Deferred.fn(wyrmhole, 'sendMessage');
        return send(['New', mimetype, args]).then(function(spawnId) {
            return tools.wrapAlienWyrmling(wyrmhole, spawnId, 0);
        }).then(function(queenling) {
            Object.defineProperty(queenling, 'destroy', {
                value: function() {
                    return send(['Destroy', queenling.spawnId]);
                }
            });
            return queenling;
        }, function(error) {
            console.log("CREATE ERROR:", error);
            return Deferred.reject(error);
        });
    }

    function asVal(obj) {
        if (tools.isPrimitive(obj)) { return obj; }
        return { $type: 'json', data: obj };
    }
});

Make queenling.destroy non-writable, non-enumerable, non-configurable