Giter Site home page Giter Site logo

Comments (7)

jonathanvdc avatar jonathanvdc commented on August 30, 2024

Oh, that's pretty interesting. Do you also want to integrate !!/!!. into EC#? If so, in what way would obj!!.field differ from obj.field?

from ecsharp.

qwertie avatar qwertie commented on August 30, 2024

It probably doesn't make sense in EC# - in Kotlin there are separate data types Object and Object? so !! is needed to convert the latter into the former. EC# is not likely to add non-null types except to copy whatever C# does. I also consider LES as having higher priority since I need to make a bunch of decisions before porting the LES parser to other languages. I would welcome your input on the questions mentioned here... as well as the minus sign issue.

from ecsharp.

jonathanvdc avatar jonathanvdc commented on August 30, 2024

Your post about parsing negative numbers was an interesting read.

I think keeping LES as simple as possible is probably the best strategy. Always using string notation for negative numbers (i.e., number"-1" or i"-1", as you suggested in your post) seems like a solid strategy. My reasoning is this:

  • People who want to use LES as a DSL (like you did in your graphing calculator) will probably end up implementing unary minus anyway, so they won't care whether LES parses -1 as @-(1) or as a -1 literal.
  • People who want to use LES as a data storage format (this is actually pretty much what Flame IR uses LES for) won't care much either because their files will typically be computer-generated. They'll probably spend way more time reading LES files than writing them, and i"-1" is readable enough.

I'm not saying that parsing -1 as a literal has no valid use cases (manually writing a Flame IR file, for example, is one). But they really don't justify a complex implementation with funny edge cases in my opinion.

from ecsharp.

Starwer avatar Starwer commented on August 30, 2024

Apparently, C# 8.0 will revolutionize the null-type by making all types value-types by default, unless declared otherwise using the ? postfix like in bool? myFlag;
They will also implement a ! meaning "I know this type is not null ! (throw exception at runtime otherwise)":
if (!string.IsNullOrEmpty(obj)) length = obj!.Length;

So I think this makes the proposed !! quite pointless.

BTW, even though I am not a user of this library, I'm positively impressed about the work done here.

from ecsharp.

qwertie avatar qwertie commented on August 30, 2024

Hi Sebastien. Your comment would make sense in relation to Enhanced C#, but this is a thread about LES, which is conceptually unrelated to .NET. See http://loyc.net/les

from ecsharp.

Starwer avatar Starwer commented on August 30, 2024

Indeed! My apologies ! I mixed up the two projects. Thanks for pointing out.

from ecsharp.

qwertie avatar qwertie commented on August 30, 2024

!! and !. were actually added 2017-08-29 and I forgot to close the issue.

from ecsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.