• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# lang.Namespace类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中clojure.lang.Namespace的典型用法代码示例。如果您正苦于以下问题:C# Namespace类的具体用法?C# Namespace怎么用?C# Namespace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Namespace类属于clojure.lang命名空间,在下文中一共展示了Namespace类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: NamespaceFor

 public static Namespace NamespaceFor(Namespace n, Symbol symbol)
 {
     // Note: presumes non-nil sym.ns
     // first check against CurrentNamespace's aliases
     Symbol nsSym = Symbol.create(symbol.Namespace);
     Namespace ns = n.LookupAlias(nsSym);
     if (ns == null)
         // otherwise, check the namespaces map
         ns = Namespace.find(nsSym);
     return ns;
 }
开发者ID:starapor,项目名称:clojure-clr,代码行数:11,代码来源:Compiler.cs


示例2: maybeResolveIn

        // core.clj compatibility
        public static object maybeResolveIn(Namespace n, Symbol symbol)
        {
            // note: ns-qualified vars must already exist
            if (symbol.Namespace != null)
            {
                Namespace ns = NamespaceFor(n, symbol);
                if (ns == null)
                    return null;

                Var v = ns.FindInternedVar(Symbol.create(symbol.Name));
                if (v == null)
                    return null;
                 return v;
            }
            else if (symbol.Name.IndexOf('.') > 0 || symbol.Name[0] == '[')
                return RT.classForName(symbol.Name);
            else if (symbol.Equals(NS))
                return RT.NS_VAR;
            else if (symbol.Equals(IN_NS))
                return RT.IN_NS_VAR;
            else
            {
                object o = n.GetMapping(symbol);
                return o;
            }
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:27,代码来源:Compiler.cs


示例3: namespaceFor

 public static Namespace namespaceFor(Namespace inns, Symbol sym)
 {
     //note, presumes non-nil sym.ns
     // first check against currentNS' aliases...
     Symbol nsSym = Symbol.create(sym.Namespace);
     Namespace ns = inns.LookupAlias(nsSym);
     if (ns == null)
     {
         // ...otherwise check the Namespaces map.
         ns = Namespace.find(nsSym);
     }
     return ns;
 }
开发者ID:starapor,项目名称:clojure-clr,代码行数:13,代码来源:Compiler.cs


示例4: intern

 public static Var intern(Namespace ns, Symbol sym)
 {
     return ns.intern(sym);
 }
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:4,代码来源:Var.cs


示例5: ResolveIn

        private static object ResolveIn(Namespace n, Symbol symbol, bool allowPrivate)
        {
            // note: ns-qualified vars must already exist
            if (symbol.Namespace != null)
            {
                Namespace ns = NamespaceFor(n, symbol);
                if (ns == null)
                    throw new Exception("No such namespace: " + symbol.Namespace);

                Var v = ns.FindInternedVar(Symbol.create(symbol.Name));
                if (v == null)
                    throw new Exception("No such var: " + symbol);
                else if (v.Namespace != CurrentNamespace && !v.IsPublic && !allowPrivate)
                    throw new InvalidOperationException(string.Format("var: {0} is not public", symbol));
                return v;
            }
            else if (symbol.Name.IndexOf('.') > 0 || symbol.Name[0] == '[')
                return RT.classForName(symbol.Name);
            else if (symbol.Equals(NS))
                return RT.NS_VAR;
            else if (symbol.Equals(IN_NS))
                return RT.IN_NS_VAR;
            else
            {
                object o = n.GetMapping(symbol);
                if (o == null)
                {
                    if (RT.booleanCast(RT.ALLOW_UNRESOLVED_VARS.deref()))
                        return symbol;
                    else
                        throw new Exception(string.Format("Unable to resolve symbol: {0} in this context", symbol));
                }
                return o;
            }
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:35,代码来源:Compiler.cs


示例6: Var

 /// <summary>
 /// Construct a var in a given namespace with a given name.
 /// </summary>
 /// <param name="ns">The namespace.</param>
 /// <param name="sym">The var.</param>
 internal Var(Namespace ns, Symbol sym)
 {
     _ns = ns;
     _sym = sym;
     _threadBound = new AtomicBoolean(false);
     _root = new Unbound(this);
     setMeta(PersistentHashMap.EMPTY);
 }
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:13,代码来源:Var.cs


示例7: maybeResolveIn

        public static object maybeResolveIn(Namespace n, Symbol symbol)
        {
            // note: ns-qualified vars must already exist
            if (symbol.Namespace != null)
            {
                Namespace ns = namespaceFor(n, symbol);
                if (ns == null)
                    return null;

                Var v = ns.FindInternedVar(Symbol.intern(symbol.Name));
                if (v == null)
                    return null;
                return v;
            }
            else if (symbol.Name.IndexOf('.') > 0 && !symbol.Name.EndsWith(".")
                || symbol.Name[symbol.Name.Length - 1] == ']')              /// JAVA: symbol.Name[0] == '[')
                return RT.classForNameE(symbol.Name);
            else if (symbol.Equals(NsSym))
                return RT.NSVar;
            else if (symbol.Equals(InNsSym))
                return RT.InNSVar;
            else
            {
                object o = n.GetMapping(symbol);
                return o;
            }
        }
开发者ID:rvedam,项目名称:clojure-clr,代码行数:27,代码来源:Compiler.cs


示例8: ResolveIn

        private static object ResolveIn(Namespace n, Symbol symbol, bool allowPrivate)
        {
            // note: ns-qualified vars must already exist
            if (symbol.Namespace != null)
            {
                Namespace ns = namespaceFor(n, symbol);
                if (ns == null)
                    throw new InvalidOperationException("No such namespace: " + symbol.Namespace);

                Var v = ns.FindInternedVar(Symbol.intern(symbol.Name));
                if (v == null)
                    throw new InvalidOperationException("No such var: " + symbol);
                else if (v.Namespace != CurrentNamespace && !v.isPublic && !allowPrivate)
                    throw new InvalidOperationException(string.Format("var: {0} is not public", symbol));
                return v;
            }
            else if (symbol.Name.IndexOf('.') > 0 || symbol.Name[symbol.Name.Length - 1] == ']')
                return RT.classForNameE(symbol.Name);
            else if (symbol.Equals(NsSym))
                return RT.NSVar;
            else if (symbol.Equals(InNsSym))
                return RT.InNSVar;
            else
            {
                if (Util.equals(symbol, CompileStubSymVar.get()))
                    return CompileStubClassVar.get();

                object o = n.GetMapping(symbol);
                if (o == null)
                {
                    if (RT.booleanCast(RT.AllowUnresolvedVarsVar.deref()))
                        return symbol;
                    else
                        throw new InvalidOperationException(string.Format("Unable to resolve symbol: {0} in this context", symbol));
                }
                return o;
            }
        }
开发者ID:rvedam,项目名称:clojure-clr,代码行数:38,代码来源:Compiler.cs


示例9: addAlias

        /// <summary>
        /// Add an alias for a namespace.
        /// </summary>
        /// <param name="alias">The alias for the namespace.</param>
        /// <param name="ns">The namespace being aliased.</param>
        /// <remarks>Lowercase name for core.clj compatibility</remarks>
        public void addAlias(Symbol alias, Namespace ns)
        {
            if (alias == null || ns == null)
                throw new NullReferenceException("Expecting Symbol + Namespace");

            IPersistentMap map = Aliases;

            // race condition
            while (!map.containsKey(alias))
            {
                IPersistentMap newMap = map.assoc(alias, ns);
                _aliases.CompareAndSet(map, newMap);
                map = Aliases;
            }
            // you can rebind an alias, but only to the initially-aliased namespace
            if (!map.valAt(alias).Equals(ns))
                throw new InvalidOperationException(String.Format("Alias {0} already exists in namespace {1}, aliasing {2}",
                    alias, _name, map.valAt(alias)));
        }
开发者ID:101v,项目名称:clojure-clr,代码行数:25,代码来源:Namespace.cs


示例10: findOrCreate

 /// <summary>
 /// Find or create a namespace named by the symbol.
 /// </summary>
 /// <param name="name">The symbol naming the namespace.</param>
 /// <returns>An existing or new namespace</returns>
 public static Namespace findOrCreate(Symbol name)
 {
     Namespace ns = _namespaces.Get(name);
     if (ns != null)
         return ns;
     Namespace newns = new Namespace(name);
     ns = _namespaces.PutIfAbsent(name, newns);
     return ns == null ? newns : ns;
 }
开发者ID:101v,项目名称:clojure-clr,代码行数:14,代码来源:Namespace.cs


示例11: Var

 /// <summary>
 /// Construct a var in a given namespace with a given name.
 /// </summary>
 /// <param name="ns">The namespace.</param>
 /// <param name="sym">The var.</param>
 internal Var(Namespace ns, Symbol sym)
 {
     _ns = ns;
     _sym = sym;
     _count = new AtomicInteger();
     _root = _rootUnboundValue;
     setMeta(PersistentHashMap.EMPTY);
 }
开发者ID:101v,项目名称:clojure-clr,代码行数:13,代码来源:Var.cs



注:本文中的clojure.lang.Namespace类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# lang.PushbackTextReader类代码示例发布时间:2022-05-26
下一篇:
C# lang.MapEntry类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap