Giter VIP home page Giter VIP logo

Comments (6)

KevinRansom avatar KevinRansom commented on August 26, 2024

@tparviainen,

I am afraid this is due to a difference between C# and F# #r syntax.

In C# #r is followed by a directive string which doesn't require escaping on the \ characters.

In F# #r is followed by a string which requires \ to be escaped I'e \.

However, that is somewhat annoying so instead often we use @ strings, which are similar to directive strings in C#.

So your code would become:

#r @"C:\Users\tomip\.nuget\packages\newtonsoft.json\12.0.2\lib\netstandard2.0\Newtonsoft.Json.dll"

And that should work fine.

Kevin

from interactive.

tparviainen avatar tparviainen commented on August 26, 2024

@KevinRansom

The change you described, once implemented, will it also impact to #load or #r only? What about csx files that are #load'ed to Jupyter and that contain #r directives should those #r directives be with @ or without?

from interactive.

mehmetakbulut avatar mehmetakbulut commented on August 26, 2024

I'm not certain @ is the issue here. (which actually makes the import fail under C#)

I see the following using the C# kernel:

#r "C:/Users/Mehmet/.nuget/packages/newtonsoft.json/12.0.2/lib/netstandard2.0/Newtonsoft.Json.dll"
Invalid: Command: #r C:/Users/Mehmet/.nuget/packages/newtonsoft.json/12.0.2/lib/netstandard2.0/Newtonsoft.Json.dll

However ironically, it does load the DLL, you can refer to the namespace(s) and use included types. One big caveat: completion only works when typing using but not for anything else that involves types from the DLL.

.NET Core SDK: 3.0.100
dotnet-try: 1.0.19555.1+ee3dc325df2fb737bc0af13bbdd9927a9360e59a

from interactive.

KevinRansom avatar KevinRansom commented on August 26, 2024

@mehmetakbulut

fsi and csi are different scripting languages and there exists prior art, that we will require to be compatible with, as to what is valid in #r and #load arguments.

In F# the provided line can be:
1:

#r C:\\Users\\tomip\\.nuget\\packages\\newtonsoft.json\\12.0.2\\lib\\netstandard2.0\\Newtonsoft.Json.dll"

2:

#r @"C:\Users\tomip\.nuget\packages\newtonsoft.json\12.0.2\lib\netstandard2.0\Newtonsoft.Json.dll"

3:

#r """C:\Users\tomip\.nuget\packages\newtonsoft.json\12.0.2\lib\netstandard2.0\Newtonsoft.Json.dll"""

4:

C:/Users/tomip/.nuget/packages/newtonsoft.json/12.0.2/lib/netstandard2.0/Newtonsoft.Json.

The invalid command in your C# example is a bug in the C# #r command handler certainly we expect #r with valid linux path chars to work. Please raise a separate issue for that to avoid confusion.

In F# #r and #load strings both will require escaped strings or @"" that conform to the existing fsi script language.

C# will undoubtedly continue to use directive strings, to conform with the existing csi scripting language.

from interactive.

mehmetakbulut avatar mehmetakbulut commented on August 26, 2024

@KevinRansom That makes sense. Will create a separate issue.

from interactive.

jonsequitur avatar jonsequitur commented on August 26, 2024

image

from interactive.

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.