You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it seems that when compiling bond objects for c# (and possibly other languages) that there is no ToString() override, so when printing out a bond object in a logger, it just prints the object's name, which is not desirable.
Example:
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> cat C:\Users\mgrandi\Temp\record.bond
struct Record
{
0: string Name;
1: vector<double> Constants;
}
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64>
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> .\gbc-10.0.0-amd64.exe c# C:\Users\mgrandi\Temp\record.bond
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> ls
Directory: C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/7/2022 6:53 PM 53646880 gbc-10.0.0-amd64.exe
-a---- 9/20/2022 1:13 PM 1484 record_types.cs
PS C:\Users\mgrandi\Downloads\gbc-10.0.0-amd64> cat .\record_types.cs
//------------------------------------------------------------------------------
// This code was generated by a tool.
//
// Tool : Bond Compiler 0.12.1.0
// Input filename: C:\Users\mgrandi\Temp\record.bond
// Output filename: record_types.cs
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// <auto-generated />
//------------------------------------------------------------------------------
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace test
{
using System.Collections.Generic;
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")]
public partial class Record
{
[global::Bond.Id(0)]
public string Name { get; set; }
[global::Bond.Id(1)]
public List<double> Constants { get; set; }
public Record()
: this("test.Record", "Record")
{}
protected Record(string fullName, string name)
{
Name = "";
Constants = new List<double>();
}
}
} // test
The text was updated successfully, but these errors were encountered:
Adding this sounds reasonable at first blush. A design before implementing would be appreciated. Some questions that I foresee needing to address at the design stage:
How are collections handled?
How is inheritance handled?
How do type converters come into play?
What if someone wants to customize/override the generation/library's ToString implementation?
Is there a way to add this in that doesn't break existing users that have manually implemented ToString? (The generated classes are partial.)
An initial proposal for what a ToString representation of a Bond object should look like. Is this representation parsable? Roundtrip-able?
Bond version: 10.0.0
it seems that when compiling bond objects for c# (and possibly other languages) that there is no ToString() override, so when printing out a bond object in a logger, it just prints the object's name, which is not desirable.
Example:
The text was updated successfully, but these errors were encountered: